All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: fix naked sscanf false positives
@ 2016-02-05  8:29 Kevin Wern
  2016-02-05  9:46 ` Dan Carpenter
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Kevin Wern @ 2016-02-05  8:29 UTC (permalink / raw)
  To: kernel-janitors

There is a section of checkpatch.pl that intends to ensure the return
value of sscanf is always checked.  However, in certain cases, like in
drivers/staging/dgnc/dgnc.mod.c, the symbol for sscanf is used without
calling the function:

static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
...
{ 0x20c55ae0, __VMLINUX_SYMBOL_STR(sscanf) },
...
};

This currently results in a warning, which is undesirable. We should
adjust the script's first regex condition to match *calls* to sscanf,
not just the symbol itself.

Signed-off-by: Kevin Wern <kevin.m.wern@gmail.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0147c91..199247d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5452,7 +5452,7 @@ sub process {
 # check for naked sscanf
 		if ($^V && $^V ge 5.10.0 &&
 		    defined $stat &&
-		    $line =~ /\bsscanf\b/ &&
+		    $line =~ /\bsscanf\b\s*$balanced_parens/ &&
 		    ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
 		     $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ &&
 		     $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-02-12  5:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05  8:29 [PATCH] checkpatch.pl: fix naked sscanf false positives Kevin Wern
2016-02-05  9:46 ` Dan Carpenter
2016-02-06  5:26 ` Joe Perches
2016-02-06  6:58 ` Kevin Wern
2016-02-06 17:20 ` Joe Perches
2016-02-06 21:24 ` Kevin Wern
2016-02-06 23:08 ` Joe Perches
2016-02-12  5:35 ` Kevin Wern

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.