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: <CACRpkdbu=pkACc+gmBa_nCrYOwhXi77FzHwwUfd8A0sREPaM9w@mail.gmail.com>
Date:   Sun, 10 Dec 2023 20:46:34 +0100
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Dan Carpenter <dan.carpenter@...aro.org>
Cc:     Lee Jones <lee@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] usb: fotg210-hcd: delete an incorrect bounds test

Hi Dan,

thanks for your patch!

On Fri, Dec 8, 2023 at 10:23 AM Dan Carpenter <dan.carpenter@...aro.org> wrote:

> Here "temp" is the number of characters that we have written and "size"
> is the size of the buffer.  The intent was clearly to say that if we have
> written to the end of the buffer then stop.
>
> However, for that to work the comparison should have been done on the
> original "size" value instead of the "size -= temp" value.  Not only
> will that not trigger when we want to, but there is a small chance that
> it will trigger incorrectly before we want it to and we break from the
> loop slightly earlier than intended.
>
> This code was recently changed from using snprintf() to scnprintf().  With
> snprintf() we likely would have continued looping and passed a negative
> size parameter to snprintf().  This would have triggered an annoying
> WARN().  Now that we have converted to scnprintf() "size" will never
> drop below 1 and there is no real need for this test.  We could change
> the condition to "if (temp <= 1) goto done;" but just deleting the test
> is cleanest.

This is a great fix! Thanks for going the extra mile and fix this
when looking at the code.

> Fixes: 1dd33a9f1b95 ("usb: fotg210: Collect pieces of dual mode controller")

That's the wrong commit.
This commit just brings stuff together from old code...

I believe it should be:
Fixes: 7d50195f6c50 ("usb: host: Faraday fotg210-hcd driver")

It won't backport cleanly but it's the right commit.

> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>

With the right Fixes:
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ