Whamcloud - gitweb
LU-6142 checkpatch: Add check for %zd 21/52421/5
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 20 Sep 2023 06:43:14 +0000 (12:13 +0530)
committerOleg Drokin <green@whamcloud.com>
Wed, 25 Oct 2023 18:03:48 +0000 (18:03 +0000)
CWARN() or CERROR() requires a certain format. That is
it should start with '%s:' and end with '%d' or '%ld'.
Otherwise it will throw an warning. This patch extends
checks for type '%zd'. As few return types could be of
size_t.

Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ida4f41af6b8fda0b028daeea18231b2d01905c31
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52421
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
contrib/scripts/checkpatch.pl

index b9d5a34..00bf11e 100755 (executable)
@@ -5186,10 +5186,12 @@ sub process {
                                     "Console messages should start with '%s:' to print device name\n" . $herecurr)
                        }
 
-                       # Check for "rc = %d" or "rc = %ld" at the end of errors
-                       if ($line !~ /LCONSOLE/ && $rawline !~ /: rc = \%l?d\\n\",/) {
+                       # Check for "rc = %d" or "rc = %ld" or "rc = %zd"
+                       # at the end of errors
+                       if ($line !~ /LCONSOLE/ &&
+                           $rawline !~ /: rc = \%l|z?d\\n\",/) {
                                WARN("CERROR_RET",
-                                    "Console messages should end with ': rc = %d' or 'rc = %ld'\n" . $herecurr);
+                                    "Console messages should end with ': rc = %[lz]d'\n" . $herecurr);
                        }
 
                        # This is fine as we are only matching the first part.