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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 19 Nov 2020 02:24:41 +0530
From:   Dwaipayan Ray <dwaipayanray1@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     linux-kernel-mentees@...ts.linuxfoundation.org,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: Re: [PATCH] checkpatch: fix spacing check for return with parentheses

On Wed, Nov 18, 2020 at 1:43 AM Dwaipayan Ray <dwaipayanray1@...il.com> wrote:
>
> The spacing check is unreachable for return statements
> followed by an opening parentheses.
> For example:
>
> int foo(int bar, int baz)
> {
>         return(bar+baz);
> }
>
> There should be an error emitted for a space between
> return and the opening parentheses but checkpatch doesn't
> emit one.
>
> Fix the spacing check. Also add --fix option to
> the check.
>
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@...il.com>
> ---
>  scripts/checkpatch.pl | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8da6cde20c68..07feeb3321e2 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5176,10 +5176,13 @@ sub process {
>                                 if ($value =~ m/^\s*$FuncArg\s*(?:\?|$)/) {
>                                         ERROR("RETURN_PARENTHESES",
>                                               "return is not a function, parentheses are not required\n" . $herecurr);
> +                               } elsif ($spacing !~ /\s+/) {
> +                                       if (ERROR("SPACING",
> +                                                 "space required before the open parenthesis '('\n" . $herecurr) &&
> +                                           $fix) {
> +                                               $fixed[$fixlinenr] =~ s/\breturn\s*\(/return \(/;
> +                                       }
>                                 }
> -                       } elsif ($spacing !~ /\s+/) {
> -                               ERROR("SPACING",
> -                                     "space required before the open parenthesis '('\n" . $herecurr);
>                         }
>                 }
>
> --
> 2.27.0

Sorry for the ping Joe. Just wanted to know if this got missed.

Thanks,
Dwaipayan.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ