linux-4.16-rc1/drivers/misc/ocxl/file.c:320:broken error checking ?
    David Binderman 
    dcb314 at hotmail.com
       
    Mon Feb 12 19:58:10 AEDT 2018
    
    
  
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20180212/180f952f/attachment.html>
    
    
More information about the Linuxppc-dev
mailing list