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: <CACna6rzQfX7SxDoL-CTQp3_Ms5_K54pEa8uaUAiTPjR-un=VOg@mail.gmail.com>
Date:	Mon, 18 Apr 2016 13:38:28 +0200
From:	Rafał Miłecki <zajec5@...il.com>
To:	Mark Brown <broonie@...nel.org>,
	"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
	Vignesh R <vigneshr@...com>,
	Brian Norris <computersforpeace@...il.com>
Cc:	"open list:SPI SUBSYSTEM" <linux-spi@...r.kernel.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH for-next] spi: bcm53xx: add spi_flash_read callback for
 MMIO-based reads

On 18 April 2016 at 13:24, Mark Brown <broonie@...nel.org> wrote:
> On Mon, Apr 18, 2016 at 01:10:43PM +0200, Rafał Miłecki wrote:
>
>> +static int bcm53xxspi_flash_read(struct spi_device *spi,
>> +                              struct spi_flash_read_message *msg)
>> +{
>> +     struct bcm53xxspi *b53spi = spi_master_get_devdata(spi->master);
>> +     int ret = 0;
>> +
>> +     bcm53xxspi_enable_bspi(b53spi);
>> +     memcpy_fromio(msg->buf, b53spi->mmio_base + msg->from, msg->len);
>> +     msg->retlen = msg->len;
>
> There's no bounds check here but...

That's true, I was looking at ti_qspi_spi_flash_read and somehow
incorrectly (!) assumed there is a check above. Of course there isn't
one and there can't be, I'll simply fix this code. I guess we should
fix ti_qspi_spi_flash_read in ti-qspi driver as well.

I also realized there wasn't any fallback introduced in:
mtd: devices: m25p80: add support for mmap read request
http://git.infradead.org/l2-mtd.git/commitdiff/08922f644878c9163ada8df3ef9def89be1d5e90

What shall we do if spi_flash_read fails? Should we always fallback to
the standard SPI flash read? Or should we standarize error codes
returned by spi_flash_read and fallback on some particular error code
only?


>> +     if (core->addr_s[0])
>> +             b53spi->mmio_base = devm_ioremap(dev, core->addr_s[0], SZ_32M);
>
> ...we only mapped 32M here.  What if something tries to do a larger
> read?  It's also a bit surprising that we're mapping a specific size
> here rather than the entire resource.

This is based on what I found in Broadcom's SDK (they don't release
any real specifications):
#define SI_NS_FLASH_WINDOW 0x02000000 /* Flash XIP Window */

-- 
Rafał

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ