* [PATCH] mt76: usb: fix warning in mt76u_buf_free [not found] <cover.1550706341.git.lorenzo@kernel.org> @ 2019-02-20 23:57 ` lorenzo 2019-02-21 5:10 ` Kalle Valo 2019-02-26 9:41 ` Felix Fietkau 0 siblings, 2 replies; 4+ messages in thread From: lorenzo @ 2019-02-20 23:57 UTC (permalink / raw) To: nbd Cc: linux-wireless, sgruszka, lorenzo.bianconi, dan.carpenter, Lorenzo Bianconi From: Lorenzo Bianconi <lorenzo@kernel.org> Fix following static checker warning in mt76u_buf_free: drivers/net/wireless/mediatek/mt76/usb.c:372 mt76u_buf_free() warn: address of 'urb->sg[i]' is non-NULL There is no need to check sg page pointer since urb->num_sgs has been already validated in mt76u_fill_rx_sg Fixes: cb83585e1121 ("mt76: usb: fix possible memory leak in mt76u_buf_free") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- drivers/net/wireless/mediatek/mt76/usb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c index cbfddf2ebfeb..ac3da948d43a 100644 --- a/drivers/net/wireless/mediatek/mt76/usb.c +++ b/drivers/net/wireless/mediatek/mt76/usb.c @@ -364,16 +364,11 @@ mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf) void mt76u_buf_free(struct mt76u_buf *buf) { struct urb *urb = buf->urb; - struct scatterlist *sg; int i; - for (i = 0; i < urb->num_sgs; i++) { - sg = &urb->sg[i]; - if (!sg) - continue; + for (i = 0; i < urb->num_sgs; i++) + skb_free_frag(sg_virt(&urb->sg[i])); - skb_free_frag(sg_virt(sg)); - } if (buf->buf) skb_free_frag(buf->buf); -- 2.20.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: usb: fix warning in mt76u_buf_free 2019-02-20 23:57 ` [PATCH] mt76: usb: fix warning in mt76u_buf_free lorenzo @ 2019-02-21 5:10 ` Kalle Valo 2019-02-21 7:15 ` Lorenzo Bianconi 2019-02-26 9:41 ` Felix Fietkau 1 sibling, 1 reply; 4+ messages in thread From: Kalle Valo @ 2019-02-21 5:10 UTC (permalink / raw) To: lorenzo; +Cc: nbd, linux-wireless, sgruszka, lorenzo.bianconi, dan.carpenter lorenzo@kernel.org writes: > From: Lorenzo Bianconi <lorenzo@kernel.org> > > Fix following static checker warning in mt76u_buf_free: > drivers/net/wireless/mediatek/mt76/usb.c:372 mt76u_buf_free() > warn: address of 'urb->sg[i]' is non-NULL > > There is no need to check sg page pointer since urb->num_sgs > has been already validated in mt76u_fill_rx_sg > > Fixes: cb83585e1121 ("mt76: usb: fix possible memory leak in mt76u_buf_free") > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> The merge window is really close, should I take this directly to wireless-drivers-next? BTW, Lorenzo please add your name to SMTP From line to make threading cleaner: From: lorenzo@kernel.org -- Kalle Valo ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: usb: fix warning in mt76u_buf_free 2019-02-21 5:10 ` Kalle Valo @ 2019-02-21 7:15 ` Lorenzo Bianconi 0 siblings, 0 replies; 4+ messages in thread From: Lorenzo Bianconi @ 2019-02-21 7:15 UTC (permalink / raw) To: Kalle Valo; +Cc: nbd, linux-wireless, sgruszka, lorenzo.bianconi, dan.carpenter [-- Attachment #1: Type: text/plain, Size: 963 bytes --] > lorenzo@kernel.org writes: > > > From: Lorenzo Bianconi <lorenzo@kernel.org> > > > > Fix following static checker warning in mt76u_buf_free: > > drivers/net/wireless/mediatek/mt76/usb.c:372 mt76u_buf_free() > > warn: address of 'urb->sg[i]' is non-NULL > > > > There is no need to check sg page pointer since urb->num_sgs > > has been already validated in mt76u_fill_rx_sg > > > > Fixes: cb83585e1121 ("mt76: usb: fix possible memory leak in mt76u_buf_free") > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> > > The merge window is really close, should I take this directly to > wireless-drivers-next? Hi Kalle, I think this patch can go in Felix's tree for the moment since it just fixes the warning, the intended behaviour is to run skb_free_frag() Regards, Lorenzo > > BTW, Lorenzo please add your name to SMTP From line to make threading > cleaner: > > From: lorenzo@kernel.org > > -- > Kalle Valo [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: usb: fix warning in mt76u_buf_free 2019-02-20 23:57 ` [PATCH] mt76: usb: fix warning in mt76u_buf_free lorenzo 2019-02-21 5:10 ` Kalle Valo @ 2019-02-26 9:41 ` Felix Fietkau 1 sibling, 0 replies; 4+ messages in thread From: Felix Fietkau @ 2019-02-26 9:41 UTC (permalink / raw) To: lorenzo; +Cc: linux-wireless, sgruszka, lorenzo.bianconi, dan.carpenter On 2019-02-21 00:57, lorenzo@kernel.org wrote: > From: Lorenzo Bianconi <lorenzo@kernel.org> > > Fix following static checker warning in mt76u_buf_free: > drivers/net/wireless/mediatek/mt76/usb.c:372 mt76u_buf_free() > warn: address of 'urb->sg[i]' is non-NULL > > There is no need to check sg page pointer since urb->num_sgs > has been already validated in mt76u_fill_rx_sg > > Fixes: cb83585e1121 ("mt76: usb: fix possible memory leak in mt76u_buf_free") > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Applied, thanks. - Felix ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-26 9:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1550706341.git.lorenzo@kernel.org>
2019-02-20 23:57 ` [PATCH] mt76: usb: fix warning in mt76u_buf_free lorenzo
2019-02-21 5:10 ` Kalle Valo
2019-02-21 7:15 ` Lorenzo Bianconi
2019-02-26 9:41 ` Felix Fietkau
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox