lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Sep 2021 21:15:20 +0100
From:   Andy Whitcroft <apw@...onical.com>
To:     Maninder Singh <maninder1.s@...sung.com>
Cc:     joe@...ches.com, dwaipayanray1@...il.com, lukas.bulwahn@...il.com,
        linux-kernel@...r.kernel.org, a.sahrawat@...sung.com,
        Vaneet Narang <v.narang@...sung.com>
Subject: Re: [PATCH 1/1] scripts/checkpatch.pl: remove warning for
 pritk_deferred also

On Tue, Aug 24, 2021 at 12:05:00PM +0530, Maninder Singh wrote:
> printk_deferred also supossed to get loglevel, but checkpatch.pl
> returns warning for same.
> 
> WARNING: Possible unnecessary KERN_ALERT
> +printk_deferred(KERN_ALERT "checking deferred\n");
> 
> total: 0 errors, 1 warnings, 20 lines checked
> 
> Thus removing warning for printk_deferred also.
> 
> Signed-off-by: Vaneet Narang <v.narang@...sung.com>
> Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 161ce7fe5d1e..e3bea0d36c10 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6252,7 +6252,7 @@ sub process {
>  		}
>  
>  # check for logging functions with KERN_<LEVEL>
> -		if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
> +		if ($line !~ /printk(?:_ratelimited|_once|_deferred)?\s*\(/ &&
>  		    $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
>  			my $level = $1;
>  			if (WARN("UNNECESSARY_KERN_LEVEL",
> -- 
> 2.17.1
> 

It looks sensible to add `_deferred`, there also looks to be an
`_deferred_once` variant which should also be added.  See the first
stanza of `$logFunctions`.  We might also consider splitting up
`$logFunctions` so that we can consume the reset without that first
stanza?  Something like this (completly untested):

    our $logFunctionsCore = qr{(?x:
        (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
        TP_printk|
        WARN(?:_RATELIMIT|_ONCE|)|
        panic|
        MODULE_[A-Z_]+|
        seq_vprintf|seq_printf|seq_puts
    )};
    our $logFunctions = qr{(?x:
        printk(?:_ratelimited|_once|_deferred_once|_deferred|)|
	$logFunctionsCore
    )};


-apw

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ