{"id":2227804,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2227804/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260424093919.500059-3-pvorel@suse.cz/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.1/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260424093919.500059-3-pvorel@suse.cz>","date":"2026-04-24T09:39:17","name":"[2/4] checkpatch: Update to use new features","commit_ref":null,"pull_url":null,"state":"needs-review-ack","archived":false,"hash":"0c6d60ac283527d59a8d6d7718f1f1599115eda7","submitter":{"id":70792,"url":"http://patchwork.ozlabs.org/api/1.1/people/70792/?format=json","name":"Petr Vorel","email":"pvorel@suse.cz"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260424093919.500059-3-pvorel@suse.cz/mbox/","series":[{"id":501330,"url":"http://patchwork.ozlabs.org/api/1.1/series/501330/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=501330","date":"2026-04-24T09:39:16","name":"checkpatch: Add .checkpatch.conf","version":1,"mbox":"http://patchwork.ozlabs.org/series/501330/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2227804/comments/","check":"warning","checks":"http://patchwork.ozlabs.org/api/patches/2227804/checks/","tags":{},"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256\n header.s=susede2_rsa header.b=jJXqPZfd;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.cz\n header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=+4+o3tiR;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa\n header.b=zbTzJcS1;\n\tdkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=xy0DEudQ;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=213.254.12.146; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)","smtp-out1.suse.de;\n dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=zbTzJcS1;\n dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=xy0DEudQ"],"Received":["from picard.linux.it (picard.linux.it [213.254.12.146])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g27Gq4CnLz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 19:40:03 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id EE4FB3E5342\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 11:40:00 +0200 (CEST)","from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id C3EEE3E2D71\n for <ltp@lists.linux.it>; Fri, 24 Apr 2026 11:39:34 +0200 (CEST)","from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-6.smtp.seeweb.it (Postfix) with ESMTPS id F3DD31400DF4\n for <ltp@lists.linux.it>; Fri, 24 Apr 2026 11:39:33 +0200 (CEST)","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104:10:150:64:97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id 16DF56A8A2;\n Fri, 24 Apr 2026 09:39:31 +0000 (UTC)","from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E0F20593A7;\n Fri, 24 Apr 2026 09:39:30 +0000 (UTC)","from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id AG56NVI662l0TQAAD6G6ig\n (envelope-from <pvorel@suse.cz>); Fri, 24 Apr 2026 09:39:30 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1777023572;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=zIglvZ1NvYAwgnwAw8J+b2UIYrhdI9V8xaKfwoE5Elw=;\n b=jJXqPZfdsJ3nKYAVMBuUz3Nz6gjf+XJZXq2EyFmrC/M/BaaPwnr/4bfNUYBZh04fBWlLG5\n FyDLVqtKsail/G/wUKghUzihXYuwpmX4HLrAP9h1zMWHDLpXYvZZvCgvDqqi5qDuzgpywl\n D6ybrlDIlPztHMzvM8VqvhS/o2/P+vY=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1777023572;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=zIglvZ1NvYAwgnwAw8J+b2UIYrhdI9V8xaKfwoE5Elw=;\n b=+4+o3tiRRk5yxd+sTKQMflE89SSznjWsvrC2bMXhKxxbDNAvzcdNAy0R7XQVsRy7NZ2w5q\n xPVkUXbfyKE78HBA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_rsa;\n t=1777023571;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=zIglvZ1NvYAwgnwAw8J+b2UIYrhdI9V8xaKfwoE5Elw=;\n b=zbTzJcS1Ae/AaVxXetlxNdjePvjL5Yuc4ELAarNF+8pp4nfIjT0apUB6JADWHFvuqxfDvz\n 9PRDo17VYI9dBcYJ/hz/jBD8MlNjOwJzamUO+cQZr6rA1EXnCexEnvgUs+YsSphFjdImtY\n 1rlY/8WQrcRQ9ZW2Pm9iZubkdnhhC6I=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz;\n s=susede2_ed25519; t=1777023571;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=zIglvZ1NvYAwgnwAw8J+b2UIYrhdI9V8xaKfwoE5Elw=;\n b=xy0DEudQs2AL9SLoke22UnoUYMwqW8z5JCjia+8rCxnh2XpmPKgcfoRFfNK1cXt03B5jp+\n MG9YiQ+5Fp+IxcAQ=="],"From":"Petr Vorel <pvorel@suse.cz>","To":"ltp@lists.linux.it","Date":"Fri, 24 Apr 2026 11:39:17 +0200","Message-ID":"<20260424093919.500059-3-pvorel@suse.cz>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260424093919.500059-1-pvorel@suse.cz>","References":"<20260424093919.500059-1-pvorel@suse.cz>","MIME-Version":"1.0","X-Spamd-Result":"default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000];\n R_MISSING_CHARSET(0.50)[];\n R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+];\n TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2];\n DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_TLS_ALL(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:mid,suse.cz:dkim,suse.cz:email,checkpatch.pl:url,include:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns];\n RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n DKIM_TRACE(0.00)[suse.cz:+]","X-Rspamd-Action":"no action","X-Spam-Score":"-3.01","X-Spam-Level":"","X-Rspamd-Server":"rspamd1.dmz-prg2.suse.org","X-Rspamd-Queue-Id":"16DF56A8A2","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-6.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-6.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH 2/4] checkpatch: Update to use new features","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"Update checkpatch.pl to use new features:\n\n596d45eb6a409 (\"checkpatch: add option to not force /* */ for SPDX\")\n50fa4906c7465 (\"checkpatch: allow passing config directory\")\n\n(Use latest next tree next-20260423 with applied 2 patches from Andrew\nMorton's mm tree, which will be part of v7.1.)\n\nhttps://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git/log/?h=mm-everything\n\nSigned-off-by: Petr Vorel <pvorel@suse.cz>\n---\nNOTE: git hashes will probably change, I'll wait till it gets into\nmainline (or at least into next tree) and update hashes before merge.\n\nKind regards,\nPetr\n\n scripts/checkpatch.pl | 133 +++++++++++++++++++++++++++++++++++-------\n 1 file changed, 111 insertions(+), 22 deletions(-)","diff":"diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl\nindex c70fcfbb3c..0d18771f1b 100755\n--- a/scripts/checkpatch.pl\n+++ b/scripts/checkpatch.pl\n@@ -57,8 +57,12 @@ my %ignore_type = ();\n my @ignore = ();\n my $help = 0;\n my $configuration_file = \".checkpatch.conf\";\n+my $def_configuration_dirs_help = '.:$HOME:.scripts';\n+(my $def_configuration_dirs = $def_configuration_dirs_help) =~ s/\\$(\\w+)/$ENV{$1}/g;\n+my $env_config_dir = 'CHECKPATCH_CONFIG_DIR';\n my $max_line_length = 100;\n my $ignore_perl_version = 0;\n+my $spdx_cxx_comments = 0;\n my $minimum_perl_version = 5.10.0;\n my $min_conf_desc_length = 4;\n my $spelling_file = \"$D/spelling.txt\";\n@@ -135,6 +139,10 @@ Options:\n                              file.  It's your fault if there's no backup or git\n   --ignore-perl-version      override checking of perl version.  expect\n                              runtime errors.\n+  --spdx-cxx-comments        don't force C comments (/* */) for SPDX license\n+                             (required by old toolchains), allow also C++\n+                             comments (//).\n+                             NOTE: it should *not* be used for Linux mainline.\n   --codespell                Use the codespell dictionary for spelling/typos\n                              (default:$codespellfile)\n   --codespellfile            Use this codespell dictionary\n@@ -146,6 +154,11 @@ Options:\n   -h, --help, --version      display this help and exit\n \n When FILE is - read standard input.\n+\n+CONFIGURATION FILE\n+Default configuration options can be stored in $configuration_file,\n+search path: '$def_configuration_dirs_help' or in a directory specified by\n+\\$$env_config_dir environment variable (fallback to the default search path).\n EOM\n \n \texit($exitcode);\n@@ -237,7 +250,7 @@ sub list_types {\n \texit($exitcode);\n }\n \n-my $conf = which_conf($configuration_file);\n+my $conf = which_conf($configuration_file, $env_config_dir, $def_configuration_dirs);\n if (-f $conf) {\n \tmy @conf_args;\n \topen(my $conffile, '<', \"$conf\")\n@@ -339,6 +352,7 @@ GetOptions(\n \t'fix!'\t\t=> \\$fix,\n \t'fix-inplace!'\t=> \\$fix_inplace,\n \t'ignore-perl-version!' => \\$ignore_perl_version,\n+\t'spdx-cxx-comments!' => \\$spdx_cxx_comments,\n \t'debug=s'\t=> \\%debug,\n \t'test-only=s'\t=> \\$tst_only,\n \t'codespell!'\t=> \\$codespell,\n@@ -641,6 +655,7 @@ our $signature_tags = qr{(?xi:\n \tReviewed-by:|\n \tReported-by:|\n \tSuggested-by:|\n+\tAssisted-by:|\n \tTo:|\n \tCc:\n )};\n@@ -1102,7 +1117,9 @@ our $declaration_macros = qr{(?x:\n \t(?:$Storage\\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\\s*\\(|\n \t(?:$Storage\\s+)?[HLP]?LIST_HEAD\\s*\\(|\n \t(?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\\s*\\(|\n-\t(?:$Storage\\s+)?(?:XA_STATE|XA_STATE_ORDER)\\s*\\(\n+\t(?:$Storage\\s+)?(?:XA_STATE|XA_STATE_ORDER)\\s*\\(|\n+\t__cacheline_group_(?:begin|end)(?:_aligned)?\\s*\\(|\n+\t__dma_from_device_group_(?:begin|end)\\s*\\(\n )};\n \n our %allow_repeated_words = (\n@@ -1528,9 +1545,15 @@ sub which {\n }\n \n sub which_conf {\n-\tmy ($conf) = @_;\n+\tmy ($conf, $env_key, $paths) = @_;\n+\tmy $env_dir = $ENV{$env_key};\n+\n+\tif (defined($env_dir) && $env_dir ne \"\") {\n+\t\treturn \"$env_dir/$conf\" if (-e \"$env_dir/$conf\");\n+\t\twarn \"$P: Can't find a readable $conf in '$env_dir', falling back to default search paths\\n\";\n+\t}\n \n-\tforeach my $path (split(/:/, \".:$ENV{HOME}:.scripts\")) {\n+\tforeach my $path (split(/:/, $paths)) {\n \t\tif (-e \"$path/$conf\") {\n \t\t\treturn \"$path/$conf\";\n \t\t}\n@@ -2926,7 +2949,7 @@ sub process {\n \t\t\t}\n \t\t\t$checklicenseline = 1;\n \n-\t\t\tif ($realfile !~ /^MAINTAINERS/) {\n+\t\t\tif ($realfile !~ /^(MAINTAINERS|dev\\/null)/) {\n \t\t\t\tmy $last_binding_patch = $is_binding_patch;\n \n \t\t\t\t$is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;\n@@ -3033,6 +3056,16 @@ sub process {\n \t\t\t}\n \t\t}\n \n+# Check for invalid patch separator\n+\t\tif ($in_commit_log &&\n+\t\t    $line =~ /^---.+/) {\n+\t\t\tif (ERROR(\"BAD_COMMIT_SEPARATOR\",\n+\t\t\t\t  \"Invalid commit separator - some tools may have problems applying this\\n\" . $herecurr) &&\n+\t\t\t    $fix) {\n+\t\t\t\t$fixed[$fixlinenr] =~ s/-/=/g;\n+\t\t\t}\n+\t\t}\n+\n # Check for patch separator\n \t\tif ($line =~ /^---$/) {\n \t\t\t$has_patch_separator = 1;\n@@ -3093,6 +3126,15 @@ sub process {\n \t\t\t\t}\n \t\t\t}\n \n+\t\t\t# Assisted-by uses AGENT_NAME:MODEL_VERSION format, not email\n+\t\t\tif ($sign_off =~ /^Assisted-by:/i) {\n+\t\t\t\tif ($email !~ /^\\S+:\\S+/) {\n+\t\t\t\t\tWARN(\"BAD_SIGN_OFF\",\n+\t\t\t\t\t     \"Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format\\n\" . $herecurr);\n+\t\t\t\t}\n+\t\t\t\tnext;\n+\t\t\t}\n+\n \t\t\tmy ($email_name, $name_comment, $email_address, $comment) = parse_email($email);\n \t\t\tmy $suggested_email = format_email(($email_name, $name_comment, $email_address, $comment));\n \t\t\tif ($suggested_email eq \"\") {\n@@ -3779,26 +3821,33 @@ sub process {\n \t\t\t\t$checklicenseline = 2;\n \t\t\t} elsif ($rawline =~ /^\\+/) {\n \t\t\t\tmy $comment = \"\";\n-\t\t\t\tif ($realfile =~ /\\.(h|s|S)$/) {\n-\t\t\t\t\t$comment = '/*';\n-\t\t\t\t} elsif ($realfile =~ /\\.(c|rs|dts|dtsi)$/) {\n+\t\t\t\tif ($realfile =~ /\\.(c|rs|dts|dtsi)$/) {\n \t\t\t\t\t$comment = '//';\n \t\t\t\t} elsif (($checklicenseline == 2) || $realfile =~ /\\.(sh|pl|py|awk|tc|yaml)$/) {\n \t\t\t\t\t$comment = '#';\n \t\t\t\t} elsif ($realfile =~ /\\.rst$/) {\n \t\t\t\t\t$comment = '..';\n \t\t\t\t}\n+\t\t\t\tmy $pattern = qr{\\Q$comment\\E};\n+\t\t\t\tif ($realfile =~ /\\.(h|s|S)$/) {\n+\t\t\t\t\t$comment = '/*';\n+\t\t\t\t\t$pattern = qr{/\\*};\n+\t\t\t\t\tif ($spdx_cxx_comments) {\n+\t\t\t\t\t\t$comment = '// or /*';\n+\t\t\t\t\t\t$pattern = qr{//|/\\*};\n+\t\t\t\t\t}\n+\t\t\t\t}\n \n # check SPDX comment style for .[chsS] files\n \t\t\t\tif ($realfile =~ /\\.[chsS]$/ &&\n \t\t\t\t    $rawline =~ /SPDX-License-Identifier:/ &&\n-\t\t\t\t    $rawline !~ m@^\\+\\s*\\Q$comment\\E\\s*@) {\n+\t\t\t\t    $rawline !~ m@^\\+\\s*$pattern\\s*@) {\n \t\t\t\t\tWARN(\"SPDX_LICENSE_TAG\",\n \t\t\t\t\t     \"Improper SPDX comment style for '$realfile', please use '$comment' instead\\n\" . $herecurr);\n \t\t\t\t}\n \n \t\t\t\tif ($comment !~ /^$/ &&\n-\t\t\t\t    $rawline !~ m@^\\+\\Q$comment\\E SPDX-License-Identifier: @) {\n+\t\t\t\t    $rawline !~ m@^\\+$pattern SPDX-License-Identifier: @) {\n \t\t\t\t\tWARN(\"SPDX_LICENSE_TAG\",\n \t\t\t\t\t     \"Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\\n\" . $herecurr);\n \t\t\t\t} elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {\n@@ -3844,6 +3893,14 @@ sub process {\n \t\t\t     \"Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\\n\" . $herecurr);\n \t\t}\n \n+# check for disallowed SPDX file tags\n+\t\tif ($rawline =~ /\\bSPDX-.*:/ &&\n+\t\t    $rawline !~ /\\bSPDX-License-Identifier:/ &&\n+\t\t    $rawline !~ /\\bSPDX-FileCopyrightText:/) {\n+\t\t\tWARN(\"SPDX_LICENSE_TAG\",\n+\t\t\t     \"Disallowed SPDX tag\\n\" . $herecurr);\n+\t\t}\n+\n # line length limit (with some exclusions)\n #\n # There are a few types of lines that may extend beyond $max_line_length:\n@@ -5648,9 +5705,7 @@ sub process {\n \t\t\tmy $comp = $3;\n \t\t\tmy $to = $4;\n \t\t\tmy $newcomp = $comp;\n-\n-\t\t\tif ($const !~ /^\\QTST_/ &&\n-\t\t\t    $lead !~ /(?:$Operators|\\.)\\s*$/ &&\n+\t\t\tif ($lead !~ /(?:$Operators|\\.)\\s*$/ &&\n \t\t\t    $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ &&\n \t\t\t    WARN(\"CONSTANT_COMPARISON\",\n \t\t\t\t \"Comparisons should place the constant on the right side of the test\\n\" . $herecurr) &&\n@@ -6737,6 +6792,13 @@ sub process {\n \t\t\t}\n \t\t}\n \n+# check for context_unsafe without a comment.\n+\t\tif ($line =~ /\\bcontext_unsafe\\b/ &&\n+\t\t    !ctx_has_comment($first_line, $linenr)) {\n+\t\t\tWARN(\"CONTEXT_UNSAFE\",\n+\t\t\t     \"context_unsafe without comment\\n\" . $herecurr);\n+\t\t}\n+\n # check of hardware specific defines\n \t\tif ($line =~ m@^.\\s*\\#\\s*if.*\\b(__i386__|__powerpc64__|__sun__|__s390x__)\\b@ && $realfile !~ m@include/asm-@) {\n \t\t\tCHK(\"ARCH_DEFINES\",\n@@ -7142,7 +7204,7 @@ sub process {\n \t\t\t\tif ($count == 1 &&\n \t\t\t\t    $format =~ /^\"\\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])\"$/) {\n \t\t\t\t\tWARN(\"SSCANF_TO_KSTRTO\",\n-\t\t\t\t\t     \"Prefer tst_parse_<type> to single variable sscanf\\n\" . \"$here\\n$stat_real\\n\");\n+\t\t\t\t\t     \"Prefer kstrto<type> to single variable sscanf\\n\" . \"$here\\n$stat_real\\n\");\n \t\t\t\t}\n \t\t\t}\n \t\t}\n@@ -7262,17 +7324,42 @@ sub process {\n \t\t\t    \"Prefer $3(sizeof(*$1)...) over $3($4...)\\n\" . $herecurr);\n \t\t}\n \n-# check for (kv|k)[mz]alloc with multiplies that could be kmalloc_array/kvmalloc_array/kvcalloc/kcalloc\n+# check for (kv|k)[mz]alloc that could be kmalloc_obj/kvmalloc_obj/kzalloc_obj/kvzalloc_obj\n+\t\tif ($perl_version_ok &&\n+\t\t    defined $stat &&\n+\t\t    $stat =~ /^\\+\\s*($Lval)\\s*\\=\\s*(?:$balanced_parens)?\\s*((?:kv|k)[mz]alloc)\\s*\\(\\s*($FuncArg)\\s*,/) {\n+\t\t\tmy $oldfunc = $3;\n+\t\t\tmy $a1 = $4;\n+\t\t\tmy $newfunc = \"kmalloc_obj\";\n+\t\t\t$newfunc = \"kvmalloc_obj\" if ($oldfunc eq \"kvmalloc\");\n+\t\t\t$newfunc = \"kvzalloc_obj\" if ($oldfunc eq \"kvzalloc\");\n+\t\t\t$newfunc = \"kzalloc_obj\" if ($oldfunc eq \"kzalloc\");\n+\n+\t\t\tif ($a1 =~ s/^sizeof\\s*\\S\\(?([^\\)]*)\\)?$/$1/) {\n+\t\t\t\tmy $cnt = statement_rawlines($stat);\n+\t\t\t\tmy $herectx = get_stat_here($linenr, $cnt, $here);\n+\n+\t\t\t\tif (WARN(\"ALLOC_WITH_SIZEOF\",\n+\t\t\t\t\t \"Prefer $newfunc over $oldfunc with sizeof\\n\" . $herectx) &&\n+\t\t\t\t    $cnt == 1 &&\n+\t\t\t\t    $fix) {\n+\t\t\t\t\t$fixed[$fixlinenr] =~ s/\\b($Lval)\\s*\\=\\s*(?:$balanced_parens)?\\s*((?:kv|k)[mz]alloc)\\s*\\(\\s*($FuncArg)\\s*,/$1 = $newfunc($a1,/;\n+\t\t\t\t}\n+\t\t\t}\n+\t\t}\n+\n+\n+# check for (kv|k)[mz]alloc with multiplies that could be kmalloc_objs/kvmalloc_objs/kzalloc_objs/kvzalloc_objs\n \t\tif ($perl_version_ok &&\n \t\t    defined $stat &&\n \t\t    $stat =~ /^\\+\\s*($Lval)\\s*\\=\\s*(?:$balanced_parens)?\\s*((?:kv|k)[mz]alloc)\\s*\\(\\s*($FuncArg)\\s*\\*\\s*($FuncArg)\\s*,/) {\n \t\t\tmy $oldfunc = $3;\n \t\t\tmy $a1 = $4;\n \t\t\tmy $a2 = $10;\n-\t\t\tmy $newfunc = \"kmalloc_array\";\n-\t\t\t$newfunc = \"kvmalloc_array\" if ($oldfunc eq \"kvmalloc\");\n-\t\t\t$newfunc = \"kvcalloc\" if ($oldfunc eq \"kvzalloc\");\n-\t\t\t$newfunc = \"kcalloc\" if ($oldfunc eq \"kzalloc\");\n+\t\t\tmy $newfunc = \"kmalloc_objs\";\n+\t\t\t$newfunc = \"kvmalloc_objs\" if ($oldfunc eq \"kvmalloc\");\n+\t\t\t$newfunc = \"kvzalloc_objs\" if ($oldfunc eq \"kvzalloc\");\n+\t\t\t$newfunc = \"kzalloc_objs\" if ($oldfunc eq \"kzalloc\");\n \t\t\tmy $r1 = $a1;\n \t\t\tmy $r2 = $a2;\n \t\t\tif ($a1 =~ /^sizeof\\s*\\S/) {\n@@ -7288,7 +7375,9 @@ sub process {\n \t\t\t\t\t \"Prefer $newfunc over $oldfunc with multiply\\n\" . $herectx) &&\n \t\t\t\t    $cnt == 1 &&\n \t\t\t\t    $fix) {\n-\t\t\t\t\t$fixed[$fixlinenr] =~ s/\\b($Lval)\\s*\\=\\s*(?:$balanced_parens)?\\s*((?:kv|k)[mz]alloc)\\s*\\(\\s*($FuncArg)\\s*\\*\\s*($FuncArg)/$1 . ' = ' . \"$newfunc(\" . trim($r1) . ', ' . trim($r2)/e;\n+\t\t\t\t\tmy $sized = trim($r2);\n+\t\t\t\t\t$sized =~ s/^sizeof\\s*\\S\\(?([^\\)]*)\\)?$/$1/;\n+\t\t\t\t\t$fixed[$fixlinenr] =~ s/\\b($Lval)\\s*\\=\\s*(?:$balanced_parens)?\\s*((?:kv|k)[mz]alloc)\\s*\\(\\s*($FuncArg)\\s*\\*\\s*($FuncArg)/$1 . ' = ' . \"$newfunc(\" . $sized . ', ' . trim($r1)/e;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n@@ -7458,10 +7547,10 @@ sub process {\n \t\t}\n \n # check for various structs that are normally const (ops, kgdb, device_tree)\n-# and avoid what seem like struct definitions 'struct foo {'\n+# and avoid what seem like struct definitions 'struct foo {' or forward declarations 'struct foo;'\n \t\tif (defined($const_structs) &&\n \t\t    $line !~ /\\bconst\\b/ &&\n-\t\t    $line =~ /\\bstruct\\s+($const_structs)\\b(?!\\s*\\{)/) {\n+\t\t    $line =~ /\\bstruct\\s+($const_structs)\\b(?!\\s*[\\{;])/) {\n \t\t\tWARN(\"CONST_STRUCT\",\n \t\t\t     \"struct $1 should normally be const\\n\" . $herecurr);\n \t\t}\n","prefixes":["2/4"]}