All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	kgdb-bugreport@lists.sourceforge.net, dcb314@hotmail.com,
	jason.wessel@windriver.com
Subject: Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
Date: Tue, 22 Jul 2014 07:47:21 +0000	[thread overview]
Message-ID: <20140722074721.GM25880@mwanda> (raw)
In-Reply-To: <1405697692-23816-1-git-send-email-andrey.krieger.utkin@gmail.com>

On Fri, Jul 18, 2014 at 06:34:52PM +0300, Andrey Utkin wrote:
>  static char *kdb_bptype(kdb_bp_t *bp)
>  {
> -	if (bp->bp_type < 0 || bp->bp_type > 4)
> +	if (bp->bp_type > 4)
>  		return "";

With Smatch, I ignore negative checks in this format.  It's obvious what
the intent is and they are harmless.  Patching them requires a little
review to make sure that someone isn't introducing a bug and can't be
done directly in the email client.

On the other hand, in Smatch I do complain about checks like:

	if (bp->bp_type > 4 || bp->bp_type < 0)

Because only backwards thinking people write checks like that.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	kgdb-bugreport@lists.sourceforge.net, dcb314@hotmail.com,
	jason.wessel@windriver.com
Subject: Re: [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value
Date: Tue, 22 Jul 2014 10:47:21 +0300	[thread overview]
Message-ID: <20140722074721.GM25880@mwanda> (raw)
In-Reply-To: <1405697692-23816-1-git-send-email-andrey.krieger.utkin@gmail.com>

On Fri, Jul 18, 2014 at 06:34:52PM +0300, Andrey Utkin wrote:
>  static char *kdb_bptype(kdb_bp_t *bp)
>  {
> -	if (bp->bp_type < 0 || bp->bp_type > 4)
> +	if (bp->bp_type > 4)
>  		return "";

With Smatch, I ignore negative checks in this format.  It's obvious what
the intent is and they are harmless.  Patching them requires a little
review to make sure that someone isn't introducing a bug and can't be
done directly in the email client.

On the other hand, in Smatch I do complain about checks like:

	if (bp->bp_type > 4 || bp->bp_type < 0)

Because only backwards thinking people write checks like that.

regards,
dan carpenter


  parent reply	other threads:[~2014-07-22  7:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 15:34 [PATCH 4/5] kernel/debug/kdb/kdb_bp.c: drop negativity check on unsigned value Andrey Utkin
2014-07-18 15:34 ` Andrey Utkin
2014-07-18 17:18 ` walter harms
2014-07-18 17:18   ` walter harms
2014-07-18 17:41   ` Andrey Utkin
2014-07-18 17:41     ` Andrey Utkin
2014-07-22  7:47 ` Dan Carpenter [this message]
2014-07-22  7:47   ` 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=20140722074721.GM25880@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=andrey.krieger.utkin@gmail.com \
    --cc=dcb314@hotmail.com \
    --cc=jason.wessel@windriver.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@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.