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]
Date:   Sat, 25 May 2019 09:28:16 -0400
From:   Sven Van Asbroeck <thesven73@...il.com>
To:     Nishka Dasgupta <nishkadg.linux@...il.com>
Cc:     Greg KH <gregkh@...uxfoundation.org>, colin.king@...onical.com,
        devel@...verdev.osuosl.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] staging: gdm724x: Remove variable

On Fri, May 24, 2019 at 2:04 AM Nishka Dasgupta
<nishkadg.linux@...il.com> wrote:
>
> The return variable is used only twice (in two different branches), and
> both times it is assigned the same constant value. These can therefore
> be merged into the same assignment, placed at the point that both
> these branches (and no other) go to. The return variable itself can be
> removed.

>  fail:
>         release_usb(udev);
> -       return ret;
> +       return -ENOMEM;
>  }

At the risk of sticking my nose where it doesn't belong...

AFAIK it's a well-established pattern to have a success path returning 0,
and an error path returning ret, where ret gets assigned the err value.

This patch removes the pattern, making it slightly harder for developers
to read. And if the function needs to return different err values in the
future, that future patch will need to add the ret variable back in.

Modern compilers optimize ret away, so the patch won't result in
smaller or more efficient code.

This particular patch sounds like negative work to me.

Powered by blists - more mailing lists