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] [thread-next>] [day] [month] [year] [list]
Message-ID: <5932130.I5bQ6OmJFL@localhost.localdomain>
Date:   Fri, 21 Feb 2020 16:50:37 +0000
From:   <Tudor.Ambarus@...rochip.com>
To:     <j.neuschaefer@....net>
CC:     <linux-mtd@...ts.infradead.org>, <miquel.raynal@...tlin.com>,
        <richard@....at>, <vigneshr@...com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mtd: spi-nor: Simplify loop in spi_nor_read_id()

On Friday, February 21, 2020 6:22:48 PM EET Jonathan Neuschäfer wrote:
> On Wed, Feb 19, 2020 at 08:06:08AM +0000, Tudor.Ambarus@...rochip.com wrote:
> [...]
> 
> > >  static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
> > >  {
> > > 
> > > -       int                     tmp;
> > > +       int                     tmp, i;
> > 
> > while cleaning this function, would you rename tmp with ret?
> 
> Good idea, I'll do that in v2.
> 
> > >         u8                      *id = nor->bouncebuf;
> > 
> > and please drop this tab between u8 and *id
> 
> The same with the other variables in this functions? They have tabs
> between the type and the pointer star / name as well.

yes, please.

> 
> > >         const struct flash_info *info;

how about getting rid of this local variable? Use in the function something 
like:

                if (spi_nor_ids[i].id_len &&
                    !memcmp(spi_nor_ids[i].id, id, spi_nor_ids[i].id_len)
                    return &spi_nor_ids[i];

> > 
> > Also, IMO, the definition of variables should be done with the focus of
> > avoiding stack padding. With this in mind, I would first define the
> > pointers and then the ints and smaller types. But there are others than
> > prefer defining the variables in a tree/reverse-tree way, depending of
> > the length of the line. There's no agreement on this, either way if fine,
> > do as you prefer.
> I have no preference here. I think I'll keep it as is for now.
> 

Ok. Cheers,
ta



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ