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]
Date:   Wed, 14 Nov 2018 22:46:03 +0800 (CST)
From:   "Liu Xiang" <liuxiang_1999@....com>
To:     "Boris Brezillon" <boris.brezillon@...tlin.com>
Cc:     "Liu Xiang" <liu.xiang6@....com.cn>, linux-mtd@...ts.infradead.org,
        linux-kernel@...r.kernel.org, marek.vasut@...il.com,
        dwmw2@...radead.org, computersforpeace@...il.com, richard@....at,
        "Tudor Ambarus" <tudor.ambarus@...rochip.com>
Subject: Re:Re: [PATCH] mtd: spi-nor: Return error when nor->addr_width not
 match the device size


Hi,
If the check is moved to
[2]https://elixir.bootlin.com/linux/v4.20-rc2/source/drivers/mtd/spi-nor/spi-nor.c#L3758,
the nor->addr_width selection logic may be needed to rework. 

I have sent an email to ISSI for the register value, but haven't got the reply.
Do you think it is better to add this check until I get the right answer from ISSI?



At 2018-11-14 21:51:29, "Boris Brezillon" <boris.brezillon@...tlin.com> wrote:
>On Wed, 14 Nov 2018 20:56:05 +0800
>Liu Xiang <liu.xiang6@....com.cn> wrote:
>
>> In is25lp256, the DWORD1 of JEDEC Basic Flash Parameter Header
>> is 0xfff920e5. So the DWORD1[18:17] Address Bytes bits are 0b00,
>> means that 3-Byte only addressing.
>
>According to your other patch this NOR supports 4B opcode, which means
>the SFDP table is wrong.
>
>> But the device size is larger
>> than 16MB, nor->addr_width must be 4 to access the whole address.
>> An error should be returned when nor->addr_width not match
>
>						   ^does not
>
>> the device size in spi_nor_parse_sfdp().
>> 
>> Suggested-by: Boris Brezillon <boris.brezillon@...tlin.com>
>> Signed-off-by: Liu Xiang <liu.xiang6@....com.cn>
>> ---
>>  drivers/mtd/spi-nor/spi-nor.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> 
>> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
>> index 3eba13a..77eaf22 100644
>> --- a/drivers/mtd/spi-nor/spi-nor.c
>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>> @@ -2669,6 +2669,10 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
>>  	}
>>  	params->size >>= 3; /* Convert to bytes. */
>>  
>> +	/*if the device exceeds 16MiB, addr_width must be 4*/
>
>Please add a white space after '/*' and before '*/':
>
>	/* If the device exceeds 16MiB, ->addr_width must be 4. */
>
>> +	if ((params->size > 0x1000000) && (nor->addr_width == 3))
>
>Parens are not needed around sub-conditions:
>
>	if (params->size > 0x1000000 && nor->addr_width == 3)
>
>> +		return -EINVAL;
>> +
>
>I'm not sure this is correct. Looks like some NORs only support 3B
>opcodes but have a "4-byte addressing" mode (see set_4byte() [1]).
>Don't know what's reported by the BFPT section in this case though
>(BFPT_DWORD1_ADDRESS_BYTES_3_ONLY or BFPT_DWORD1_ADDRESS_BYTES_3_OR_4).
>
>Anyway, I think this check should be moved here [2] to cover the
>non-SFDP case.
>
>>  	/* Fast Read settings. */
>>  	for (i = 0; i < ARRAY_SIZE(sfdp_bfpt_reads); i++) {
>>  		const struct sfdp_bfpt_read *rd = &sfdp_bfpt_reads[i];
>
>[1]https://elixir.bootlin.com/linux/v4.20-rc2/source/drivers/mtd/spi-nor/spi-nor.c#L278
>[2]https://elixir.bootlin.com/linux/v4.20-rc2/source/drivers/mtd/spi-nor/spi-nor.c#L3758

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ