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: <6bc0cf7ea58fae2e6a3765f673a777788d465984.camel@maquefel.me>
Date:   Fri, 08 Dec 2023 14:24:52 +0300
From:   Nikita Shubin <nikita.shubin@...uefel.me>
To:     Andy Shevchenko <andriy.shevchenko@...el.com>
Cc:     Miquel Raynal <miquel.raynal@...tlin.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Arnd Bergmann <arnd@...db.de>,
        Linus Walleij <linus.walleij@...aro.org>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Daniel Golle <daniel@...rotopia.org>,
        Jean Delvare <jdelvare@...e.de>,
        Christophe Kerello <christophe.kerello@...s.st.com>,
        Chris Packham <chris.packham@...iedtelesis.co.nz>,
        Johan Jonker <jbx6244@...il.com>, linux-kernel@...r.kernel.org,
        linux-mtd@...ts.infradead.org,
        Alexander Sverdlin <alexander.sverdlin@...il.com>
Subject: Re: [PATCH v5 19/39] mtd: rawnand: add support for ts72xx

Hello Andy!

On Wed, 2023-11-22 at 14:24 +0200, Andy Shevchenko wrote:
> On Wed, Nov 22, 2023 at 11:59:57AM +0300, Nikita Shubin wrote:
> > Technologic Systems has it's own nand controller implementation in
> > CPLD.
> 
> ...
> 
> > +static int ts72xx_nand_attach_chip(struct nand_chip *chip)
> > +{
> > +       switch (chip->ecc.engine_type) {
> > +       case NAND_ECC_ENGINE_TYPE_SOFT:
> > +               if (chip->ecc.algo == NAND_ECC_ALGO_UNKNOWN)
> > +                       chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
> > +               chip->ecc.algo = NAND_ECC_ALGO_HAMMING;
> > +               break;
> > +       case NAND_ECC_ENGINE_TYPE_ON_HOST:
> > +               return -EINVAL;
> 
> > +       default:
> > +               break;
> > +       }
> > +
> > +       return 0;
> 
> Move this to default.
> 
> > +}
> 
> ...
> 
> > +               for (i = 0; i < instr->ctx.addr.naddrs; i++)
> > +                       iowrite8(instr->ctx.addr.addrs[i], data-
> > >base);
> 
> iowrite8_rep() ?
> 
> > +       case NAND_OP_DATA_IN_INSTR:
> > +               ioread8_rep(data->base, instr->ctx.data.buf.in,
> > instr->ctx.data.len);
> 
> Hehe, you are even using it...
> 
> ...
> 
> > +       if (instr->delay_ns)
> 
> What will happen if you drop this check?
> 
> > +               ndelay(instr->delay_ns);

No idea! I was asked to keep it by Miquel:

https://lore.kernel.org/lkml/8bbe66a23eb5c8a2404b72d754b1bcb6f4d23867.camel@maquefel.me/T/

But it looks some one can at least still do some calculation like:

https://elixir.bootlin.com/linux/latest/source/include/linux/delay.h#L50

At worst try to divide something.

Do you think ndelay(instr->delay_ns) is safe enough ?


> 
> ...
> 
> > +       int ret;
> > +
> > +       ret = mtd_device_unregister(nand_to_mtd(chip));
> > +       WARN_ON(ret);
> 
> Is this a requirement by MTD to have return value being checked?
> 

Aswered by Miquel.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ