public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: spi-nor: core: correct type of i
@ 2024-03-04  9:01 Muhammad Usama Anjum
  2024-03-04  9:11 ` Tudor Ambarus
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-04  9:01 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Takahiro Kuwano
  Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-mtd,
	linux-kernel

The i should be signed to find out the end of the loop. Otherwise,
i >= 0 is always true and loop becomes infinite. Make its type to be
int.

Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v1:
- Make i int instead of u8
---
 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 65b32ea59afc6..3e1f1913536bf 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3373,7 +3373,7 @@ static u32
 spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region,
 			     const struct spi_nor_erase_type *erase_type)
 {
-	u8 i;
+	int i;
 
 	if (region->overlaid)
 		return region->size;
-- 
2.39.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
@ 2024-03-04  9:11 ` Tudor Ambarus
  2024-03-04  9:16 ` Michael Walle
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Tudor Ambarus @ 2024-03-04  9:11 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Pratyush Yadav, Michael Walle,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Takahiro Kuwano
  Cc: kernel, kernel-janitors, linux-mtd, linux-kernel

Miquel,

Can you please queue this to mtd/next after you pull in the SPI NOR
changes? Thanks!

ta

On 3/4/24 09:01, Muhammad Usama Anjum wrote:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
> 
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>

> ---
> Changes since v1:
> - Make i int instead of u8
> ---
>  drivers/mtd/spi-nor/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 65b32ea59afc6..3e1f1913536bf 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3373,7 +3373,7 @@ static u32
>  spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region,
>  			     const struct spi_nor_erase_type *erase_type)
>  {
> -	u8 i;
> +	int i;
>  
>  	if (region->overlaid)
>  		return region->size;

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
  2024-03-04  9:11 ` Tudor Ambarus
@ 2024-03-04  9:16 ` Michael Walle
  2024-03-04 10:11 ` Dan Carpenter
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Michael Walle @ 2024-03-04  9:16 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Tudor Ambarus, Pratyush Yadav,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Takahiro Kuwano
  Cc: kernel, kernel-janitors, linux-mtd, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 430 bytes --]

On Mon Mar 4, 2024 at 10:01 AM CET, Muhammad Usama Anjum wrote:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
>
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: Michael Walle <mwalle@kernel.org>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
  2024-03-04  9:11 ` Tudor Ambarus
  2024-03-04  9:16 ` Michael Walle
@ 2024-03-04 10:11 ` Dan Carpenter
  2024-03-04 10:32 ` AngeloGioacchino Del Regno
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2024-03-04 10:11 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Takahiro Kuwano, kernel,
	kernel-janitors, linux-mtd, linux-kernel

On Mon, Mar 04, 2024 at 02:01:03PM +0500, Muhammad Usama Anjum wrote:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
> 
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes since v1:
> - Make i int instead of u8

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
                   ` (2 preceding siblings ...)
  2024-03-04 10:11 ` Dan Carpenter
@ 2024-03-04 10:32 ` AngeloGioacchino Del Regno
  2024-03-05  1:10 ` Takahiro Kuwano
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-03-04 10:32 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Tudor Ambarus, Pratyush Yadav,
	Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Takahiro Kuwano
  Cc: kernel, kernel-janitors, linux-mtd, linux-kernel

Il 04/03/24 10:01, Muhammad Usama Anjum ha scritto:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
> 
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
                   ` (3 preceding siblings ...)
  2024-03-04 10:32 ` AngeloGioacchino Del Regno
@ 2024-03-05  1:10 ` Takahiro Kuwano
  2024-03-11 17:11 ` Muhammad Usama Anjum
  2024-03-13 22:23 ` Miquel Raynal
  6 siblings, 0 replies; 10+ messages in thread
From: Takahiro Kuwano @ 2024-03-05  1:10 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Tudor Ambarus, Pratyush Yadav,
	Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Takahiro Kuwano
  Cc: kernel, kernel-janitors, linux-mtd, linux-kernel

Hi,

Thanks for pointing out and fixing this.

Takahiro

On 3/4/2024 6:01 PM, Muhammad Usama Anjum wrote:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
> 
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes since v1:
> - Make i int instead of u8
> ---
>  drivers/mtd/spi-nor/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 65b32ea59afc6..3e1f1913536bf 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3373,7 +3373,7 @@ static u32
>  spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region,
>  			     const struct spi_nor_erase_type *erase_type)
>  {
> -	u8 i;
> +	int i;
>  
>  	if (region->overlaid)
>  		return region->size;

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
                   ` (4 preceding siblings ...)
  2024-03-05  1:10 ` Takahiro Kuwano
@ 2024-03-11 17:11 ` Muhammad Usama Anjum
  2024-03-12 12:14   ` Pratyush Yadav
  2024-03-13 22:23 ` Miquel Raynal
  6 siblings, 1 reply; 10+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-11 17:11 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Takahiro Kuwano
  Cc: Muhammad Usama Anjum, kernel, kernel-janitors, linux-mtd,
	linux-kernel

Soft reminder

On 3/4/24 2:01 PM, Muhammad Usama Anjum wrote:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
> 
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes since v1:
> - Make i int instead of u8
> ---
>  drivers/mtd/spi-nor/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 65b32ea59afc6..3e1f1913536bf 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3373,7 +3373,7 @@ static u32
>  spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region,
>  			     const struct spi_nor_erase_type *erase_type)
>  {
> -	u8 i;
> +	int i;
>  
>  	if (region->overlaid)
>  		return region->size;

-- 
BR,
Muhammad Usama Anjum

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-11 17:11 ` Muhammad Usama Anjum
@ 2024-03-12 12:14   ` Pratyush Yadav
  2024-03-12 12:16     ` Muhammad Usama Anjum
  0 siblings, 1 reply; 10+ messages in thread
From: Pratyush Yadav @ 2024-03-12 12:14 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Tudor Ambarus, Pratyush Yadav, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Takahiro Kuwano, kernel,
	kernel-janitors, linux-mtd, linux-kernel

Hi,

On Mon, Mar 11 2024, Muhammad Usama Anjum wrote:

> Soft reminder

Miquel should pick up the patch when sending out his pull request [0].

[0] https://lore.kernel.org/linux-mtd/20240307180919.4cb7a4cb@xps-13/

>
> On 3/4/24 2:01 PM, Muhammad Usama Anjum wrote:
>> The i should be signed to find out the end of the loop. Otherwise,
>> i >= 0 is always true and loop becomes infinite. Make its type to be
>> int.
>> 
>> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>> Changes since v1:
>> - Make i int instead of u8
>> ---
>>  drivers/mtd/spi-nor/core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>> index 65b32ea59afc6..3e1f1913536bf 100644
>> --- a/drivers/mtd/spi-nor/core.c
>> +++ b/drivers/mtd/spi-nor/core.c
>> @@ -3373,7 +3373,7 @@ static u32
>>  spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region,
>>  			     const struct spi_nor_erase_type *erase_type)
>>  {
>> -	u8 i;
>> +	int i;
>>  
>>  	if (region->overlaid)
>>  		return region->size;

-- 
Regards,
Pratyush Yadav

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-12 12:14   ` Pratyush Yadav
@ 2024-03-12 12:16     ` Muhammad Usama Anjum
  0 siblings, 0 replies; 10+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-12 12:16 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: Muhammad Usama Anjum, Tudor Ambarus, Michael Walle, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, Takahiro Kuwano, kernel,
	kernel-janitors, linux-mtd, linux-kernel

On 3/12/24 5:14 PM, Pratyush Yadav wrote:
> Hi,
> 
> On Mon, Mar 11 2024, Muhammad Usama Anjum wrote:
> 
>> Soft reminder
> 
> Miquel should pick up the patch when sending out his pull request [0].
> 
> [0] https://lore.kernel.org/linux-mtd/20240307180919.4cb7a4cb@xps-13/
Thanks Pratyush!

> 
>>
>> On 3/4/24 2:01 PM, Muhammad Usama Anjum wrote:
>>> The i should be signed to find out the end of the loop. Otherwise,
>>> i >= 0 is always true and loop becomes infinite. Make its type to be
>>> int.
>>>
>>> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>> ---
>>> Changes since v1:
>>> - Make i int instead of u8
>>> ---
>>>  drivers/mtd/spi-nor/core.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>>> index 65b32ea59afc6..3e1f1913536bf 100644
>>> --- a/drivers/mtd/spi-nor/core.c
>>> +++ b/drivers/mtd/spi-nor/core.c
>>> @@ -3373,7 +3373,7 @@ static u32
>>>  spi_nor_get_region_erasesize(const struct spi_nor_erase_region *region,
>>>  			     const struct spi_nor_erase_type *erase_type)
>>>  {
>>> -	u8 i;
>>> +	int i;
>>>  
>>>  	if (region->overlaid)
>>>  		return region->size;
> 

-- 
BR,
Muhammad Usama Anjum

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] mtd: spi-nor: core: correct type of i
  2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
                   ` (5 preceding siblings ...)
  2024-03-11 17:11 ` Muhammad Usama Anjum
@ 2024-03-13 22:23 ` Miquel Raynal
  6 siblings, 0 replies; 10+ messages in thread
From: Miquel Raynal @ 2024-03-13 22:23 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Tudor Ambarus, Pratyush Yadav,
	Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Takahiro Kuwano
  Cc: kernel, kernel-janitors, linux-mtd, linux-kernel

On Mon, 2024-03-04 at 09:01:03 UTC, Muhammad Usama Anjum wrote:
> The i should be signed to find out the end of the loop. Otherwise,
> i >= 0 is always true and loop becomes infinite. Make its type to be
> int.
> 
> Fixes: 6a9eda34418f ("mtd: spi-nor: core: set mtd->eraseregions for non-uniform erase map")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> Reviewed-by: Michael Walle <mwalle@kernel.org>
> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-03-13 22:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-04  9:01 [PATCH v2] mtd: spi-nor: core: correct type of i Muhammad Usama Anjum
2024-03-04  9:11 ` Tudor Ambarus
2024-03-04  9:16 ` Michael Walle
2024-03-04 10:11 ` Dan Carpenter
2024-03-04 10:32 ` AngeloGioacchino Del Regno
2024-03-05  1:10 ` Takahiro Kuwano
2024-03-11 17:11 ` Muhammad Usama Anjum
2024-03-12 12:14   ` Pratyush Yadav
2024-03-12 12:16     ` Muhammad Usama Anjum
2024-03-13 22:23 ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox