Odd smatch issue?

John Levon <[email protected]>
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.