[dm-devel] [PATCH 6/6] Introduce the ibmultipath/unaligned.h header file

Martin Wilck mwilck at suse.com
Mon Mar 5 17:18:58 UTC 2018


On Thu, 2018-03-01 at 11:29 -0800, Bart Van Assche wrote:
> This patch avoids that Coverity reports the following for the code
> in libmultipath/prioritizers/alua_rtpg.c:
> 
>    CID 173256:  Integer handling issues  (SIGN_EXTENSION)
>     Suspicious implicit sign extension: "buf[0]" with type "unsigned
> char" (8 bits, unsigned) is promoted in "((buf[0] << 24) | (buf[1] <<
> 16) | (buf[2] << 8) | buf[3]) + 4" to type "int" (32 bits, signed),
> then sign-extended to type "unsigned long" (64 bits, unsigned).  If
> "((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]) + 4" is
> greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche at wdc.com>

Reviewed-by: Martin Wilck <mwilck at suse.com>

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)




More information about the dm-devel mailing list