* linux-4.16-rc1/drivers/misc/ocxl/file.c:320:broken error checking ?
@ 2018-02-12 8:58 David Binderman
2018-02-12 9:53 ` Frederic Barrat
0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2018-02-12 8:58 UTC (permalink / raw)
To: fbarrat@linux.vnet.ibm.com, andrew.donnellan@au1.ibm.com,
arnd@arndb.de, gregkh@linuxfoundation.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
Hello there,
linux-4.16-rc1/drivers/misc/ocxl/file.c:320]: (style) Checking if unsigned variable 'used' is less than zero.
Source code is
used = append_xsl_error(ctx, &header, buf + sizeof(header));
if (used < 0)
return used;
Suggest put return value from function into signed variable, sanity check it,
then assign it to an unsigned variable.
Also, use of the gcc compiler flag -Wtype-limits will show up this kind of problem in future.
Regards
David Binderman
[-- Attachment #2: Type: text/html, Size: 1869 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: linux-4.16-rc1/drivers/misc/ocxl/file.c:320:broken error checking ?
2018-02-12 8:58 linux-4.16-rc1/drivers/misc/ocxl/file.c:320:broken error checking ? David Binderman
@ 2018-02-12 9:53 ` Frederic Barrat
0 siblings, 0 replies; 2+ messages in thread
From: Frederic Barrat @ 2018-02-12 9:53 UTC (permalink / raw)
To: David Binderman, andrew.donnellan@au1.ibm.com, arnd@arndb.de,
gregkh@linuxfoundation.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Le 12/02/2018 à 09:58, David Binderman a écrit :
> Hello there,
>
>
> linux-4.16-rc1/drivers/misc/ocxl/file.c:320]: (style) Checking if
> unsigned variable 'used' is less than zero.
>
> Source code is
>
>
> used = append_xsl_error(ctx, &header, buf + sizeof(header));
> if (used < 0)
> return used;
>
> Suggest put return value from function into signed variable, sanity
> check it,
>
> then assign it to an unsigned variable.
>
>
> Also, use of the gcc compiler flag -Wtype-limits will show up this kind
> of problem in future.
Thanks for reporting it. A patch to address it is working its way up and
should land in the next rc release.
Fred
>
> Regards
>
>
> David Binderman
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-12 9:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-12 8:58 linux-4.16-rc1/drivers/misc/ocxl/file.c:320:broken error checking ? David Binderman
2018-02-12 9:53 ` Frederic Barrat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).