Skip to content

Commit

Permalink
xsk: Fix null check on error return path
Browse files Browse the repository at this point in the history
Currently, dma_map is being checked, when the right object identifier
to be null-checked is dma_map->dma_pages, instead.

Fix this by null-checking dma_map->dma_pages.

Fixes: 921b686 ("xsk: Enable sharing of dma mappings")
Addresses-Coverity-ID: 1496811 ("Logically dead code")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/20200902150750.GA7257@embeddedor
  • Loading branch information
Gustavo A. R. Silva authored and Daniel Borkmann committed Sep 2, 2020
1 parent 968be23 commit 1d6fd78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/xdp/xsk_buff_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ static struct xsk_dma_map *xp_create_dma_map(struct device *dev, struct net_devi
return NULL;

dma_map->dma_pages = kvcalloc(nr_pages, sizeof(*dma_map->dma_pages), GFP_KERNEL);
if (!dma_map) {
if (!dma_map->dma_pages) {
kfree(dma_map);
return NULL;
}
Expand Down

0 comments on commit 1d6fd78

Please sign in to comment.