xsk: Free variable on error path
Subsystems (4)
PATCH 1/1 xsk: Free variable on error path
In xp_create_dma_map(), memory is allocated to dma_map->dma_pages, but then dma_map is erroneously compared to NULL, rather than the member. Fix this.
Addresses-Coverity: ("Dead code")
Fixes 921b68692abb ("xsk: Enable sharing of dma mappings")
Signed-off-by Alex Dewar <[email protected]>
--- net/xdp/xsk_buff_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xdp/xsk_buff_pool.c +1 -1
@@ -287,7 +287,7 @@ static struct xsk_dma_map *xp_create_dma_map(struct device *dev, struct net_devireturn 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 ; }
Signature · 1 line
2.28.0
Daniel Borkmann
maintainerQuoted 7 lines · Alex Dewar
In
xp_create_dma_map(), memory is allocated todma_map->dma_pages, but thendma_mapis erroneously compared to NULL, rather than the member. Fix this.Addresses-Coverity: ("Dead code")
Fixes 921b68692abb ("xsk: Enable sharing of dma mappings")Signed-off-by Alex Dewar <[email protected]>
Thanks, already applied a fix that was sent earlier [0].