public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: smatch warnings in current upstream kernel
Date: Tue, 11 Sep 2012 14:29:26 +0000	[thread overview]
Message-ID: <20120911142926.GW19396@mwanda> (raw)
In-Reply-To: <20120911105127.GD19410@mwanda>

On Tue, Sep 11, 2012 at 07:06:40PM +0800, Fengguang Wu wrote:
> On Tue, Sep 11, 2012 at 01:51:27PM +0300, Dan Carpenter wrote:
>
> $SMATCH -p kernel "$@" > $SMATCH_OUT_ROOT/$PPID-$$-$RANDOM

Some of the warnings you are getting seem to mean that you're not
picking up the smatch_data/ directory.  For example some of the
buffer overflow errors:

drivers/mtd/ubi/wl.c:336 prot_queue_add() warn: buffer overflow 'ubi->pq' 10 <= 10

What is happening in that function is that Smatch sees the:
	ubi_assert(pq_tail >= 0 && pq_tail < UBI_PROT_QUEUE_LEN);

and assumes that since there is a test for
"pq_tail < UBI_PROT_QUEUE_LEN" then it must be possible for
pq_tail = UBI_PROT_QUEUE_LEN.  There is a file called:
smatch_data/kernel.ignored_macros which has ubi_assert() and it
means to ignore everything that happens inside a ubi_assert().

Normally Smatch looks for the data dir with the binary, but you can
also specify a directory with --data=/path/to/smatch_data/.  Then
you can test that it's working by doing a:
	kchecker drivers/mtd/ubi/wl.c
to verify that the warning goes away.

It may cause a lot of new warnings to show up though...

regards,
dan carpenter

  parent reply	other threads:[~2012-09-11 14:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 10:51 smatch warnings in current upstream kernel Dan Carpenter
2012-09-11 11:06 ` Fengguang Wu
2012-09-11 14:29 ` Dan Carpenter [this message]
2012-09-11 14:49 ` Fengguang Wu
2012-09-12  2:48 ` Fengguang Wu
2012-09-12  6:26 ` Dan Carpenter

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=20120911142926.GW19396@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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