* [PATCH] xsk: Free variable on error path
@ 2020-09-02 16:33 Alex Dewar
2020-09-02 18:36 ` Daniel Borkmann
0 siblings, 1 reply; 2+ messages in thread
From: Alex Dewar @ 2020-09-02 16:33 UTC (permalink / raw)
Cc: Alex Dewar, Björn Töpel, Magnus Karlsson,
Jonathan Lemon, David S. Miller, Jakub Kicinski,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, netdev, bpf, linux-kernel
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 <alex.dewar90@gmail.com>
---
net/xdp/xsk_buff_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xsk: Free variable on error path
2020-09-02 16:33 [PATCH] xsk: Free variable on error path Alex Dewar
@ 2020-09-02 18:36 ` Daniel Borkmann
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2020-09-02 18:36 UTC (permalink / raw)
To: Alex Dewar
Cc: Björn Töpel, Magnus Karlsson, Jonathan Lemon,
David S. Miller, Jakub Kicinski, Alexei Starovoitov,
Jesper Dangaard Brouer, John Fastabend, netdev, bpf,
linux-kernel
On 9/2/20 6:33 PM, Alex Dewar wrote:
> 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 <alex.dewar90@gmail.com>
Thanks, already applied a fix that was sent earlier [0].
[0] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=1d6fd78a213ee3874f46bdce083b7a41d208886d
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-02 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02 16:33 [PATCH] xsk: Free variable on error path Alex Dewar
2020-09-02 18:36 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).