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] [day] [month] [year] [list]
Message-ID: <CAKwvOdkqTUWgCr+t6Ktf4U1Xy50FmurER6btCR8u=X93uLayhA@mail.gmail.com>
Date:   Mon, 12 Aug 2019 13:31:23 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] checkpatch: Prefer __section over __attribute__((section(...)))

On Mon, Aug 12, 2019 at 1:07 PM Joe Perches <joe@...ches.com> wrote:
>
> Add another test for __attribute__((section("foo"))) uses
> that should be __section(foo)
>
> Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Signed-off-by: Joe Perches <joe@...ches.com>
> Tested-by: Nick Desaulniers <ndesaulniers@...gle.com> # post PEBKAC <smile>

lol please don't commit that (PEBKAC)

> ---
>  scripts/checkpatch.pl | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1cdacb4fd207..d4153b81b1eb 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5901,6 +5901,18 @@ sub process {
>                              "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
>                 }
>
> +# Check for __attribute__ section, prefer __section
> +               if ($realfile !~ m@\binclude/uapi/@ &&
> +                   $line =~ /\b__attribute__\s*\(\s*\(.*_*section_*\s*\(\s*("[^"]*")/) {
> +                       my $old = substr($rawline, $-[1], $+[1] - $-[1]);
> +                       my $new = substr($old, 1, -1);
> +                       if (WARN("PREFER_SECTION",
> +                                "__section($new) is preferred over __attribute__((section($old)))\n" . $herecurr) &&
> +                           $fix) {
> +                               $fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*_*section_*\s*\(\s*\Q$old\E\s*\)\s*\)/__section($new)/;
> +                       }
> +               }
> +
>  # Check for __attribute__ format(printf, prefer __printf
>                 if ($realfile !~ m@\binclude/uapi/@ &&
>                     $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
>
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ