mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 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, andrew.donnellan, arnd, gregkh, linuxppc-dev, linux-kernel

[-- 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

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

all inboxes | Powered by JetHome®