Powered by Linux
Re: False Positive return_cast check — Semantic Matching Tool

Re: False Positive return_cast check

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

 



On Fri, Feb 12, 2021 at 01:42:54PM +0100, Benjamin Block wrote:
> Hello,
> 
> I hope this is the right avenue to report this.
> 
> I noticed yesterday that we get a false positive report from smatch for
> `pathmask_to_pos()` in `arch/s390/include/asm/cio.h`. When reviewing
> some code I got this error while using smatch:
> 
>     CHECK   /home/bblock/src/linux/drivers/s390/cio/device_pgid.c
>   /home/bblock/src/linux/arch/s390/include/asm/cio.h:356 pathmask_to_pos() warn: signedness bug returning '(-119)'
> 
> Which corresponds to this helper:
> 
>   static inline u8 pathmask_to_pos(u8 mask)
>   {
>   	return 8 - ffs(mask);
>   }
> 

Could you add some debug code, like this:


#include "/path/to/smatch/check_debug.h"
static inline u8 pathmask_to_pos(u8 mask)
{
	__smatch_bits(mask);
	__smatch_implied(mask);
	__smatch_implied(ffs(mask));
	return 8 - ffs(mask);
}

Then run:
/path/to/smatch/smatch_scripts/kchecker /home/bblock/src/linux/drivers/s390/cio/device_pgid.c

regards,
dan carpenter




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux