lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180625122453.souir6wzzyhbkj4m@mwanda>
Date:   Mon, 25 Jun 2018 15:24:53 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     devel@...verdev.osuosl.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Michael Straube <michael.straube@...teo.de>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: rtl8723bs: fix brace coding style issues

On Mon, Jun 25, 2018 at 12:47:44PM +0300, Andy Shevchenko wrote:
> On Fri, Jun 22, 2018 at 1:28 PM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> > On Thu, Jun 21, 2018 at 08:21:55PM +0200, Michael Straube wrote:
> >> Remove braces from single line if statements.
> >> Also fix a comparsion to NULL in one of the conditions.
> >> Issues found by checkpatch.
> >>
> >> Signed-off-by: Michael Straube <michael.straube@...teo.de>
> >> ---
> >>  drivers/staging/rtl8723bs/core/rtw_debug.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/staging/rtl8723bs/core/rtw_debug.c b/drivers/staging/rtl8723bs/core/rtw_debug.c
> >> index f852fde47350..2244ed72ab9c 100644
> >> --- a/drivers/staging/rtl8723bs/core/rtw_debug.c
> >> +++ b/drivers/staging/rtl8723bs/core/rtw_debug.c
> >> @@ -618,9 +618,8 @@ ssize_t proc_set_wait_hiq_empty(struct file *file, const char __user *buffer, si
> >>       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.
> > The sscanf call should have error checking.  The error code is wrong if
> > the copy from user fails.  The tmp buffer isn't NUL terminated.
> >
> >         if (copy_from_user(tmp, buffer, sizeof(tmp)))
> >                 return -EFAULT;
> >         tmp[sizeof(tmp) - 1] = '\0';
> >
> >         if (sscanf(tmp, "%u", &g_wait_hiq_empty) != 1)
> >                 return -EINVAL;
> >
> >         return count;
> 
> Shouldn't this be
> 
> kstrtouint_from_user()
> 
> instead of all those lines?

I wasn't sure kstrtoint() was the exact same as sscanf()...  If so then
sure.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ