All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Levon <levon@movementarian.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: smatch@vger.kernel.org
Subject: Re: Odd smatch issue?
Date: Mon, 14 Jan 2019 12:42:57 +0000	[thread overview]
Message-ID: <20190114124257.GA12158@movementarian.org> (raw)
In-Reply-To: <20190114101804.GA4482@kadam>

On Mon, Jan 14, 2019 at 01:18:04PM +0300, Dan Carpenter wrote:

> > 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];
> > }
> > 
> 
> Thanks John,
> 
> I am testing this patch:
> 
> [PATCH] extra: preserve hard_max after comparisons to zero

Thanks for taking a look. Unfortunately this still doesn't seem to cover
the original case which the above was boiled down from. This does:

 76 #define LX_CAP_CAPISSET(id, cap) \                                               
 77         (((id < 32) && (((0x1 << id) & cap[0]) != 0)) || \                       
 78         ((id >= 32) && (((0x1 << (id - 32) & cap[1]) != 0))))                    


221         for (i = 0; i <= LX_CAP_MAX_CHECK; i++) {                                
222                 cap_set = LX_CAP_CAPISSET(i, cap);                               
223                 if (lx_cap_mapping[i] == NULL || i > LX_CAP_MAX_VALID) {         

(The code is bug is on line :223 where we need to reverse the order of the checks.)

regards
john

  reply	other threads:[~2019-01-14 12:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 12:32 Odd smatch issue? John Levon
2019-01-14 10:18 ` Dan Carpenter
2019-01-14 12:42   ` John Levon [this message]
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=20190114124257.GA12158@movementarian.org \
    --to=levon@movementarian.org \
    --cc=dan.carpenter@oracle.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 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.