smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Harshvardhan Jha <harshvardhan.jha@oracle.com>
Cc: smatch@vger.kernel.org
Subject: Re: [PATCH 2/2] Fix handle_bit_test so that null set condition is taken care of
Date: Mon, 12 Jul 2021 15:59:38 +0300	[thread overview]
Message-ID: <20210712125938.GG1931@kadam> (raw)
In-Reply-To: <20210712123947.24116-2-harshvardhan.jha@oracle.com>

On Mon, Jul 12, 2021 at 06:09:47PM +0530, Harshvardhan Jha wrote:
> The handle_bit_test condition wasn't setting a false range_list for the
> false state and hence the implied rl was coming out to be false. The
> false and true rls have been calculating using rl_intersection and
> rl_filter commands.
> 

Can you fix the commit message a bit.  Assume that the person reading
your patch understands Smatch basically but doesn't remember all the
details.  I like to give a little background.  Here is my proposed
commit message:

  Imagine we have code like:

  	if ((1 << foo) & valid_bits) {

  The handle_bit_test() function is supposed to answer the question,
  "what does that mean about 'foo'"?

  This patch fixes several bugs:
  1)  The range is off by one.  ffsll() returns 1 for BIT(0) so we need
      to subtract 1 from what ffsll() returns.
  2)  This code returns early for impossible conditions but it is better
      to set "foo" to the empty state.
  3)  The false state was not set.  We can use rl_filter() for that.

regards,
dan carpenter

  reply	other threads:[~2021-07-12 13:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 12:39 [PATCH 1/2] extra: Fix false output of handle_AND_op and handle_AND_condition Harshvardhan Jha
2021-07-12 12:39 ` [PATCH 2/2] Fix handle_bit_test so that null set condition is taken care of Harshvardhan Jha
2021-07-12 12:59   ` Dan Carpenter [this message]
2021-07-12 12:46 ` [PATCH 1/2] extra: Fix false output of handle_AND_op and handle_AND_condition 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=20210712125938.GG1931@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=harshvardhan.jha@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).