From: Dan Carpenter <dan.carpenter@oracle.com>
To: Joe Perches <joe@perches.com>
Cc: Yorick Rommers <yorick-rommers@hotmail.com>,
devel@driverdev.osuosl.org, lidza.louina@gmail.com,
driverdev-devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH] Staging: dgnc: Using temporary value for repeated dereferences.
Date: Mon, 20 Apr 2015 11:33:10 +0300 [thread overview]
Message-ID: <20150420083310.GE16501@mwanda> (raw)
In-Reply-To: <1429491259.27863.1.camel@perches.com>
On Sun, Apr 19, 2015 at 05:54:19PM -0700, Joe Perches wrote:
> > diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
> > index b13318a..0437117 100644
> > --- a/drivers/staging/dgnc/dgnc_mgmt.c
> > +++ b/drivers/staging/dgnc/dgnc_mgmt.c
> > @@ -131,6 +131,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> > int brd;
> >
> > struct digi_info di;
> > + struct dgnc_board *bd = dgnc_Board[brd];
>
> Please read the code.
> brd is got from userspace and you've dereferenced
> it before getting the value from userspace.
Gar. Oops. I totally missed that when I looked at this patch. :(
You would hope that GCC would warn about the uninitialized variable but
it doesn't.
regards,
dan carpenter
next prev parent reply other threads:[~2015-04-20 8:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-19 19:18 [PATCH] Staging: dgnc: fixed code style issue Yorick Rommers
2015-04-19 20:34 ` Joe Perches
2015-04-19 21:58 ` [PATCH] Staging: dgnc: Using temporary value for repeated dereferences Yorick Rommers
2015-04-20 0:54 ` Joe Perches
2015-04-20 7:33 ` [PATCH] Staging: dgnc: Using a " Yorick Rommers
2015-05-03 18:50 ` Greg KH
2015-04-20 8:33 ` Dan Carpenter [this message]
2015-04-20 10:42 ` gcc doesn't warn about uninitialized variable use in switch/case with -O (was: Re: [PATCH] Staging: dgnc: Using temporary value for repeated dereferences) Joe Perches
2015-04-20 12:28 ` Joe Perches
2015-04-20 8:27 ` [PATCH] Staging: dgnc: Using temporary value for repeated dereferences Dan Carpenter
2015-04-20 8:13 ` [PATCH] Staging: dgnc: fixed code style issue Dan Carpenter
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=20150420083310.GE16501@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=lidza.louina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yorick-rommers@hotmail.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