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
| ||
|
Date: Sun, 25 Oct 2020 01:22:14 -0700 From: Joe Perches <joe@...ches.com> To: Dwaipayan Ray <dwaipayanray1@...il.com> Cc: linux-kernel-mentees@...ts.linuxfoundation.org, linux-kernel@...r.kernel.org, lukas.bulwahn@...il.com Subject: Re: [PATCH v4] checkpatch: extend attributes check to handle more patterns On Sun, 2020-10-25 at 12:21 +0530, Dwaipayan Ray wrote: > It is generally preferred that the macros from > include/linux/compiler_attributes.h are used, unless there > is a reason not to. > > checkpatch currently checks __attribute__ for each of > packed, aligned, printf, scanf, and weak. Other declarations > in compiler_attributes.h are not handled. > > Add a generic test to check the presence of such attributes. > Some attributes require more specific handling and are kept > separate. [] > Also add fixes for the generic attributes check. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > + if (exists($attr_list{$curr_attr})) { > + my $new = $attr_list{$curr_attr}; > + if (WARN("PREFER_DEFINED_ATTRIBUTE_MACRO", > + "$new$params is preferred over __attribute__(($attr))\n" . $herecurr) && > + $fix) { > + $fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*\Q$attr\E\s*\)\s*\)/$new$params/; Thanks. This fix would only work for the single conversions and would not work for multiple attributes like: __attribute__((aligned(4), packed)) It would be nice to be able to convert this to __aligned(4) __packed One mechanism to do that might be to: create an empty array for each attr push(@array, conversion) s/__attribute__(...)/join(' ', @array)/ if all attrs were converted.
Powered by blists - more mailing lists