linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lorenzo.bianconi@redhat.com
Cc: linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: [bug report] mt76: usb: fix possible memory leak in mt76u_buf_free
Date: Wed, 20 Feb 2019 23:57:13 +0300	[thread overview]
Message-ID: <20190220205713.GA26590@kadam> (raw)

Hello Lorenzo Bianconi,

The patch cb83585e1121: "mt76: usb: fix possible memory leak in
mt76u_buf_free" from Feb 10, 2019, leads to the following static
checker warning:

	drivers/net/wireless/mediatek/mt76/usb.c:372 mt76u_buf_free()
	warn: address of 'urb->sg[i]' is non-NULL

drivers/net/wireless/mediatek/mt76/usb.c
    362 }
    363 
    364 void mt76u_buf_free(struct mt76u_buf *buf)
    365 {
    366 	struct urb *urb = buf->urb;
    367 	struct scatterlist *sg;
    368 	int i;
    369 
    370 	for (i = 0; i < urb->num_sgs; i++) {
    371 		sg = &urb->sg[i];
--> 372 		if (!sg)
                            ^^^
This address isn't NULL.  Was something else intended?

    373 			continue;
    374 
    375 		skb_free_frag(sg_virt(sg));
    376 	}
    377 	if (buf->buf)
    378 		skb_free_frag(buf->buf);
    379 
    380 	usb_free_urb(buf->urb);
    381 }

regards,
dan carpenter

                 reply	other threads:[~2019-02-20 20:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190220205713.GA26590@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).