From: Dan Carpenter <dan.carpenter@oracle.com>
To: Benjamin Block <bblock@linux.ibm.com>
Cc: Mailing List linux-smatch <smatch@vger.kernel.org>
Subject: Re: False Positive return_cast check
Date: Mon, 15 Feb 2021 15:36:25 +0300 [thread overview]
Message-ID: <20210215123625.GI2087@kadam> (raw)
In-Reply-To: <YCZ3ziwJYDpZx2+l@t480-pf1aa2c2.linux.ibm.com>
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
next prev parent reply other threads:[~2021-02-15 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 12:42 False Positive return_cast check Benjamin Block
2021-02-15 12:36 ` Dan Carpenter [this message]
2021-02-15 16:04 ` Benjamin Block
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210215123625.GI2087@kadam \
--to=dan.carpenter@oracle.com \
--cc=bblock@linux.ibm.com \
--cc=smatch@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox