From: Julia Lawall <julia.lawall@lip6.fr>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: Joe Perches <joe@perches.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Andy Whitcroft <apw@canonical.com>
Subject: Re: [PATCH v2] checkpatch: Add a warning for log messages that don't end in a new line
Date: Mon, 27 Nov 2017 20:49:09 +0000 [thread overview]
Message-ID: <alpine.DEB.2.20.1711272146310.2405@hadrien> (raw)
In-Reply-To: <993ca1c1-6d27-2ee1-94ed-41e8249755bd@deltatee.com>
On Mon, 27 Nov 2017, Logan Gunthorpe wrote:
>
>
> On 27/11/17 11:57 AM, Joe Perches wrote:
> > It may or not be correct.
>
> It's absolutely not correct in that it either requires that a subsequent
> KERN_CONT/pr_cont or a '\n' at the end and it has neither.
>
> > Without inter-function call code flow analysis,
> > it's not possible to be correct.
>
> But how many cases actually have the pr_cont/KERN_cont called in different
> functions? This appears to be exceedingly rare to me.
>
> > If you can get the false positive & false negative
> > rate higher, I'll listen.
>
> The only two classes of false positives that you've pointed out or that I'm
> aware of:
>
> 1) The case where call did not either end in a '\n' or have a
> KERN_CONT/pr_cont in a subsequent call. I've been arguing (to deaf ears) that
> a warning is appropriate here and this is not a false positive because it
> absolutely is incorrect one way or the other. Coccinnelle will also suffer
> from this issue because it can no better decide whether the developer intended
> for the next call to be a continuation or for a '\n' to end the line.
>
> 2) Cases where the pr_cont/KERN_CONT is not in sufficient context for the
> script to detect. These are impossible to fix (and it's likely also impossible
> for Coccinelle to be 100% accurate here). However, I'd expect these to be
> *very* rare and I'm only actually aware of one case where this has actually
> happened (lib/locking-selftest.c:1189) and (mostly by luck) my v2 patch does
> not flag this where Coccinelle did. Not to mention that continuation usage is
> discouraged in new code so this should be even rarer on the majority of what
> checkpatch is used for.
>
> (also 3. would be the %pV case, but I've removed those in what could be a v3
> of the patch -- I'd also be happy to address other false positives classes if
> I could find them)
>
> False negatives are much harder to quantify or improve. But given that I
> detect nearly 6000 errors in the existing kernel it can't be *that* high.
> Also, these false negatives do nothing to negate the benefit of having this
> functionality seeing the vast majority of developers are doing simple things
> with pr_* and dev_*.
>
> Coccinelle may very well be able to do better at false negatives. But in this
> case, it would still be great to have both because checkpatch will flag a
> significant subset of the errors much earlier in the development cycle and
> save developers a bunch of time.
>
> So, in my opinion, I think focusing too hard on the false negatives deprives
> developers of what could be a useful check.
>
> > I think the Coccinelle script has a better chance
> > to be more correct.
>
> And yet, you have not pointed out any false positives that my patch gives
> which Coccinelle does/would not. It really feels to me like your biases are
> guiding your decision here and you aren't really looking at the results.
>
> Another thought I've had is that the dev_ functions don't have any form of
> continuation. So we could potentially limit checkpatch to looking for those to
> avoid the issues with continuations. It's not high coverage but at least a lot
> of the driver patches would be checked with no chance of false positives. I
> think there would be value in doing that.
Perhaps if there is a possible flow from one print to another within a
single function and in both cases the format string is at least say 25
characters (completely random value), then it is pretty likely that a
newline is intended.
Alternatively, if the first format string doesn't end in a space and the
second one doesn't begin with a space, then a newline is also likely
intended.
julia
next prev parent reply other threads:[~2017-11-27 20:49 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-26 5:40 [PATCH v2] checkpatch: Add a warning for log messages that don't end in a new line Logan Gunthorpe
2017-11-26 5:51 ` Julia Lawall
2017-11-26 6:01 ` Joe Perches
2017-11-26 17:38 ` Logan Gunthorpe
2017-11-26 22:29 ` Joe Perches
[not found] ` <alpine.DEB.2.20.1711262334370.2111@hadrien>
2017-11-27 1:12 ` Joe Perches
2017-11-27 6:08 ` Julia Lawall
2017-11-27 9:25 ` Joe Perches
2017-11-27 9:32 ` Julia Lawall
2017-11-27 9:42 ` Joe Perches
2017-11-27 17:07 ` Logan Gunthorpe
2017-11-27 17:26 ` Joe Perches
2017-11-27 17:33 ` Logan Gunthorpe
2017-11-27 17:41 ` Joe Perches
2017-11-27 17:42 ` Logan Gunthorpe
2017-11-27 4:00 ` Logan Gunthorpe
2017-11-27 6:11 ` Julia Lawall
2017-11-27 6:27 ` Logan Gunthorpe
2017-11-27 6:34 ` Julia Lawall
2017-11-27 6:40 ` Logan Gunthorpe
2017-11-27 8:28 ` Joe Perches
2017-11-27 8:52 ` Julia Lawall
2017-11-27 9:06 ` Joe Perches
2017-11-27 16:40 ` Logan Gunthorpe
2017-11-27 17:20 ` Logan Gunthorpe
2017-11-27 17:28 ` Joe Perches
2017-11-27 17:35 ` Logan Gunthorpe
2017-11-27 17:42 ` Joe Perches
2017-11-27 17:44 ` Logan Gunthorpe
2017-11-27 18:57 ` Joe Perches
2017-11-27 19:58 ` Logan Gunthorpe
2017-11-27 20:49 ` Julia Lawall [this message]
2017-11-27 22:56 ` Logan Gunthorpe
2017-11-28 0:15 ` Joe Perches
2017-11-26 16:55 ` Logan Gunthorpe
2017-11-26 17:09 ` Julia Lawall
2017-11-26 17:47 ` Logan Gunthorpe
2017-11-26 18:17 ` Julia Lawall
2017-11-26 18:33 ` Logan Gunthorpe
2017-11-27 1:35 ` Joe Perches
2017-11-27 6:40 ` Julia Lawall
2017-11-27 6:42 ` Julia Lawall
2017-11-27 6:53 ` Logan Gunthorpe
2017-11-27 6:57 ` Julia Lawall
2017-11-27 9:03 ` Joe Perches
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.20.1711272146310.2405@hadrien \
--to=julia.lawall@lip6.fr \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=logang@deltatee.com \
/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