[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180623084018.l7ail4233xc4vw7z@mwanda>
Date: Sat, 23 Jun 2018 11:40:18 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Michael Straube <michael.straube@...teo.de>
Cc: gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: fix brace coding style issues
On Fri, Jun 22, 2018 at 03:27:46PM +0200, Michael Straube wrote:
> On 06/22/18 12:28, Dan Carpenter wrote:
> > > if (count < 1)
> > > return -EFAULT;
> > > - if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp))) {
> > > + if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
> > > sscanf(tmp, "%u", &g_wait_hiq_empty);
> > > - }
> >
> >
> > The original code is kind of bad. The NULL check isn't required.
>
> Just for clarification, NULL check refers to checking if buffer != NULL in the
> if condition?
>
> if (buffer && !copy_from_user(tmp, buffer, sizeof(tmp)))
> ~~~~~~
Yes. If buffer is NULL that's just another invalid pointer which the
user cannot access, it's not special, and the copy will fail.
regards,
dan carpenter
Powered by blists - more mailing lists