mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Michael Straube <michael.straube@posteo.de>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: fix brace coding style issues
Date: Sat, 23 Jun 2018 11:40:18 +0300	[thread overview]
Message-ID: <20180623084018.l7ail4233xc4vw7z@mwanda> (raw)
In-Reply-To: <bc244970-498d-c6e7-7ed0-3c3d77777ccc@posteo.de>

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


  reply	other threads:[~2018-06-23  8:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 18:21 Michael Straube
2018-06-22 10:28 ` Dan Carpenter
2018-06-22 13:27   ` Michael Straube
2018-06-23  8:40     ` Dan Carpenter [this message]
2018-06-25  9:47   ` Andy Shevchenko
2018-06-25 12:24     ` Dan Carpenter
2018-06-26 19:09       ` Andy Shevchenko

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=20180623084018.l7ail4233xc4vw7z@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.straube@posteo.de \
    /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

all inboxes | Powered by JetHome®