summaryrefslogtreecommitdiff
path: root/net/xdp
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2020-09-02 18:07:50 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2020-09-02 21:31:50 +0300
commit1d6fd78a213ee3874f46bdce083b7a41d208886d (patch)
tree91a4955f728ef00a3f56a33f3d92234658e29bf7 /net/xdp
parent968be23ceaca1f402dfad0a30a8da4649ee32940 (diff)
downloadlinux-1d6fd78a213ee3874f46bdce083b7a41d208886d.tar.xz
xsk: Fix null check on error return path
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: 921b68692abb ("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
Diffstat (limited to 'net/xdp')
-rw-r--r--net/xdp/xsk_buff_pool.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index 795d7c81c0ca..5b00bc5707f2 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -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;
}