From: David Miller <davem@davemloft.net>
To: jj@chaosbits.net
Cc: linux-kernel@vger.kernel.org, oliver@neukum.name, gregkh@suse.de,
linux-usb@vger.kernel.org, netdev@vger.kernel.org,
alexey.orishko@stericsson.com,
hans.petter.selasky@stericsson.com
Subject: Re: [PATCH] USB CDC NCM: Don't deref NULL in cdc_ncm_rx_fixup() and don't use uninitialized variable.
Date: Thu, 13 Jan 2011 21:50:28 -0800 (PST) [thread overview]
Message-ID: <20110113.215028.237355303.davem@davemloft.net> (raw)
In-Reply-To: <alpine.LNX.2.00.1101132229260.11347@swampdragon.chaosbits.net>
From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 13 Jan 2011 22:40:11 +0100 (CET)
> skb_clone() dynamically allocates memory and may fail. If it does it
> returns NULL. This means we'll dereference a NULL pointer in
> drivers/net/usb/cdc_ncm.c::cdc_ncm_rx_fixup().
> As far as I can tell, the proper way to deal with this is simply to goto
> the error label.
>
> Furthermore gcc complains that 'skb' may be used uninitialized:
> drivers/net/usb/cdc_ncm.c: In function ‘cdc_ncm_rx_fixup’:
> drivers/net/usb/cdc_ncm.c:922:18: warning: ‘skb’ may be used uninitialized in this function
> and I believe it is right. On the line where we
> pr_debug("invalid frame detected (ignored)" ...
> we are using the local variable 'skb' but nothing has ever been assigned
> to that variable yet. I believe the correct fix for that is to use
> 'skb_in' instead.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Applied.
prev parent reply other threads:[~2011-01-14 5:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-13 21:40 [PATCH] USB CDC NCM: Don't deref NULL in cdc_ncm_rx_fixup() and don't use uninitialized variable Jesper Juhl
2011-01-14 5:50 ` David Miller [this message]
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=20110113.215028.237355303.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=alexey.orishko@stericsson.com \
--cc=gregkh@suse.de \
--cc=hans.petter.selasky@stericsson.com \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oliver@neukum.name \
/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).