mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: julia.lawall@lip6.fr,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Michal Marek <mmarek@suse.com>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	cocci@systeme.lip6.fr, elfring@users.sourceforge.net
Subject: Re: [PATCH v2] coccinelle: assign signed result to unsigned variable
Date: Sat, 3 Oct 2015 09:09:22 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1510030901180.2022@localhost6.localdomain6> (raw)
In-Reply-To: <1443437687-16559-1-git-send-email-a.hajda@samsung.com>

Some comments:

If you get 20 good results and 22 false positives, I'm not sure whether 
high confidence is justified.  That seemes more like moderate confidence.

On the other hand, I think it is possible to get rid of the false 
positives.  The false positives are coming from the fact that you have:

if ( \( vu < 0 \| vu <= 0 \) ) S1 else S2

This can be flipped around to

if ( ! \( vu < 0 \| vu <= 0 \) ) S2 else S1

and then when we propagate the ! into the disjunction, we get v >= 0 for 
the first condition and v > 0 for the second condition.  v >= 0 is always 
true, so it could be reasonable to highlight it, but v > 0 is a perfectly 
reasonable test for an unsigned value, and is where you are getting the 
false positives from.  If you want to get rid of both v >= 0 and v < 0 
then you can just put disable neg_if in the initial @@, just after r, ie

@r disable neg_if@

On the other hand, if you want to keep the warning on v >= 0 but drop the 
warning on v > 0, then you will have to split the rules and put the 
disable neg_if on the one for v <= 0.

I think it would also be reasonable to merge the proposed semantic 
patches.  I guess this one gives most of the results anyway?

With recursive_includes, I got 70 results, at least 20 of which should be 
false positives due to the MB case.

julia

      parent reply	other threads:[~2015-10-03  7:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 12:54 [PATCH] " Andrzej Hajda
2015-09-24 15:51 ` SF Markus Elfring
2015-09-25 10:08   ` Andrzej Hajda
2015-09-25 15:51     ` SF Markus Elfring
2015-09-26  7:45     ` SF Markus Elfring
2015-09-26  9:07       ` Julia Lawall
2015-09-26  9:41         ` SF Markus Elfring
2015-09-26  9:45           ` Julia Lawall
2015-09-26  9:52             ` SF Markus Elfring
2015-09-26  9:55               ` Julia Lawall
2015-09-26 11:43                 ` SF Markus Elfring
2015-09-26 13:55                   ` Julia Lawall
2015-09-26 15:22                     ` SF Markus Elfring
2015-09-26 15:30                       ` Julia Lawall
2015-09-26 15:50                         ` SF Markus Elfring
2015-09-26 15:55                           ` Julia Lawall
2015-09-26 16:01                             ` SF Markus Elfring
2015-09-28 10:54         ` [PATCH v2] " Andrzej Hajda
2015-09-28 11:32           ` Julia Lawall
2015-09-28 11:59             ` Andrzej Hajda
2015-09-30 21:51               ` Julia Lawall
2015-09-28 12:07           ` SF Markus Elfring
2015-09-28 12:12             ` Andrzej Hajda
2015-09-28 12:20               ` SF Markus Elfring
2015-09-28 12:42                 ` [Cocci] " Julia Lawall
2015-09-28 12:55                   ` SF Markus Elfring
2015-09-28 13:13                     ` Julia Lawall
2015-09-28 13:53                       ` SF Markus Elfring
2015-09-28 15:07                         ` Julia Lawall
2015-10-03  7:09           ` Julia Lawall [this message]

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=alpine.DEB.2.02.1510030901180.2022@localhost6.localdomain6 \
    --to=julia.lawall@lip6.fr \
    --cc=Gilles.Muller@lip6.fr \
    --cc=a.hajda@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mmarek@suse.com \
    --cc=nicolas.palix@imag.fr \
    /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

all inboxes | Powered by JetHome®