Re: [lustre-devel] [PATCH] staging/lustre/lnet: correctly casts value for arithmetic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jun 23, 2016, at 2:07 PM, Lidza Louina wrote:

> The smatch warning was "drivers/staging/lustre/lnet/lnet/api-ni.c:516 
> lnet_res_lh_initialize() warn: should '1 << ibits' be a 64 bit type?"

I think you misinterpreted it, it has nothing to do with the addition.

What it actually means is:
1 is a 32bit integer, you do a right shift by some variable number
of bits. So please check if there's risk to overflow the 32 bits
unexpectedly.
The way to fix this warning is to replace 1 with 1ULL (unsigned long long)
and that is fine to do as a way of future proofing this stuff even if it's
not yet broken yet, I guess.

> 
>> 
>> 	hash = (lh->lh_cookie >> ibits) & LNET_LH_HASH_MASK;
>> 
>> -- 
>> 1.9.1
>> 
>> 
>> 
>> _______________________________________________
>> lustre-devel mailing list
>> lustre-devel@xxxxxxxxxxxxxxxx
>> http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
> 

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux