All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Levon <levon@movementarian.org>
To: smatch@vger.kernel.org
Subject: Odd smatch issue?
Date: Fri, 11 Jan 2019 12:32:41 +0000	[thread overview]
Message-ID: <20190111123241.GA11408@movementarian.org> (raw)



static long
lx_cap_update_priv(void)
{
        const int lx_cap_mapping[4] = { 0, 0, 0 };
        int i = 63;
        /* enabling the below line disables the warning */
        //int cap_set = i == 0;
        lx_cap_mapping[i];
}


/home/gk/src/smatch/smatch: a.c:8 lx_cap_update_priv() error: buffer overflow 'lx_cap_mapping' 4 <= 63

Distilled down from some real code, obviously, but it seems odd that
just *looking* at "i" means smatch can't figure out its max value?

thanks
john

             reply	other threads:[~2019-01-11 12:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 12:32 John Levon [this message]
2019-01-14 10:18 ` Odd smatch issue? Dan Carpenter
2019-01-14 12:42   ` John Levon
2019-01-14 14:38     ` Dan Carpenter
2019-01-14 14:47       ` John Levon
2019-01-14 14:51         ` 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=20190111123241.GA11408@movementarian.org \
    --to=levon@movementarian.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.