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>] [day] [month] [year] [list]
Date:   Thu, 10 Dec 2020 18:07:23 +0100
From:   Alexandre Belloni <alexandre.belloni@...tlin.com>
To:     Markus Elfring <Markus.Elfring@....de>
Cc:     linux-mmc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] mmc: atmel-mci: Reduce scope for the variable “slot” in
 atmci_request_end()

On 10/12/2020 17:35:31+0100, Markus Elfring wrote:
> >> A local variable was used only within an if branch.
> >> Thus move the definition for the variable “slot” into the corresponding
> >> code block.
> >>
> >
> > What is the improvement here?
> 
> A possible refactoring.
> https://refactoring.com/catalog/reduceScopeOfVariable.html
> 

I quote:
"Since declarations of variables in many cases costs computational
cycles, you may end up wasting time for nothing."

This is false, it doesn't.

I also quote:
"When I'm writing new code I find I don't scope my temps any less than
method scope. This is because I keep my methods short, so reducing scope
any further doesn't add much value. The value of this refactoring is in
breaking up a large method."

Is that function large? It is not.


> 
> > This makes the code harder to read.
> 
> Can the extra null pointer initialisation trigger a source code analysis warning
> like “Addresses-Coverity: ("Unused value")” for this function implementation?
> 

Did you check, does it? It doesn't.

Are you wasting maintainer and reviewer's time? Yes you are.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ