public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
@ 2026-05-04 22:10 Arseniy Krasnov
  2026-05-05  7:50 ` Miquel Raynal
  0 siblings, 1 reply; 7+ messages in thread
From: Arseniy Krasnov @ 2026-05-04 22:10 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Frieder Schrempf, Boris Brezillon
  Cc: linux-mtd, linux-kernel, rulkc, oxffffaa, Arseniy Krasnov, stable

'cs' here must in range [0:nanddev_ntargets).

Cc: stable@vger.kernel.org
Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips")
Signed-off-by: Arseniy Krasnov <avkrasnov@rulkc.org>
---
 drivers/mtd/nand/raw/nand_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 13e4060bd1b6a..edfee22f15a73 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -174,7 +174,7 @@ void nand_select_target(struct nand_chip *chip, unsigned int cs)
 	 * cs should always lie between 0 and nanddev_ntargets(), when that's
 	 * not the case it's a bug and the caller should be fixed.
 	 */
-	if (WARN_ON(cs > nanddev_ntargets(&chip->base)))
+	if (WARN_ON(cs >= nanddev_ntargets(&chip->base)))
 		return;
 
 	chip->cur_cs = cs;
-- 
2.47.3


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

* Re: [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
  2026-05-04 22:10 [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' Arseniy Krasnov
@ 2026-05-05  7:50 ` Miquel Raynal
  2026-05-05  7:59   ` Arseniy Krasnov
  0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2026-05-05  7:50 UTC (permalink / raw)
  To: Arseniy Krasnov
  Cc: Richard Weinberger, Vignesh Raghavendra, Frieder Schrempf,
	Boris Brezillon, linux-mtd, linux-kernel, rulkc, oxffffaa, stable

Hi,

On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:

Two important typos in the commit log :-)

> 'cs' here must in range [0:nanddev_ntargets).

                be                           [

Thanks,
Miquèl

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

* Re: [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
  2026-05-05  7:50 ` Miquel Raynal
@ 2026-05-05  7:59   ` Arseniy Krasnov
  2026-05-05  8:10     ` Miquel Raynal
  0 siblings, 1 reply; 7+ messages in thread
From: Arseniy Krasnov @ 2026-05-05  7:59 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Vignesh Raghavendra, Frieder Schrempf,
	Boris Brezillon, linux-mtd, linux-kernel, rulkc, oxffffaa, stable


05.05.2026 10:50, Miquel Raynal wrote:
> Hi,
>
> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>
> Two important typos in the commit log :-)
>
>> 'cs' here must in range [0:nanddev_ntargets).
>                 be                           [


Hi, sorry, You mean?


'cs' here must be in range [0:nanddev_ntargets]. 


Thanks


>
> Thanks,
> Miquèl

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

* Re: [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
  2026-05-05  7:59   ` Arseniy Krasnov
@ 2026-05-05  8:10     ` Miquel Raynal
  2026-05-05  8:14       ` Arseniy Krasnov
  0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2026-05-05  8:10 UTC (permalink / raw)
  To: Arseniy Krasnov
  Cc: Richard Weinberger, Vignesh Raghavendra, Frieder Schrempf,
	Boris Brezillon, linux-mtd, linux-kernel, rulkc, oxffffaa, stable

On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:

> 05.05.2026 10:50, Miquel Raynal wrote:
>> Hi,
>>
>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>>
>> Two important typos in the commit log :-)
>>
>>> 'cs' here must in range [0:nanddev_ntargets).
>>                 be                           [
>
>
> Hi, sorry, You mean?
>
>
> 'cs' here must be in range [0:nanddev_ntargets]. 

I meant [0:nanddev_ntargets[ which is the mathematical way, IIRC, to
indicate that the last value is out of scope/excluded.

[0:nanddev_ntargets] means that nanddev_ntargets is included in the
scope of values and here since you are explicitly showing that it is
not, it feels wrong to use that convention.

Thanks,
Miquèl

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

* Re: [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
  2026-05-05  8:10     ` Miquel Raynal
@ 2026-05-05  8:14       ` Arseniy Krasnov
  2026-05-05  8:23         ` Miquel Raynal
  0 siblings, 1 reply; 7+ messages in thread
From: Arseniy Krasnov @ 2026-05-05  8:14 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Vignesh Raghavendra, Frieder Schrempf,
	Boris Brezillon, linux-mtd, linux-kernel, rulkc, oxffffaa, stable


05.05.2026 11:10, Miquel Raynal wrote:
> On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>
>> 05.05.2026 10:50, Miquel Raynal wrote:
>>> Hi,
>>>
>>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>>>
>>> Two important typos in the commit log :-)
>>>
>>>> 'cs' here must in range [0:nanddev_ntargets).
>>>                 be                           [
>>
>> Hi, sorry, You mean?
>>
>>
>> 'cs' here must be in range [0:nanddev_ntargets]. 
> I meant [0:nanddev_ntargets[ which is the mathematical way, IIRC, to
> indicate that the last value is out of scope/excluded.
>
> [0:nanddev_ntargets] means that nanddev_ntargets is included in the
> scope of values and here since you are explicitly showing that it is
> not, it feels wrong to use that convention.


Ahh, Yes I see, just small misunderstood in math symbols:

I mean: [A:B) == [A:B[

https://wikimedia.org/api/rest_v1/media/math/render/svg/0719b1b08cdf649e735e6dab6dc7355fa37a9b21

Ok, I'll update it!

Thanks!

>
> Thanks,
> Miquèl

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

* Re: [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
  2026-05-05  8:14       ` Arseniy Krasnov
@ 2026-05-05  8:23         ` Miquel Raynal
  2026-05-05 11:46           ` Arseniy Krasnov
  0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2026-05-05  8:23 UTC (permalink / raw)
  To: Arseniy Krasnov
  Cc: Richard Weinberger, Vignesh Raghavendra, Frieder Schrempf,
	Boris Brezillon, linux-mtd, linux-kernel, rulkc, oxffffaa, stable


On 05/05/2026 at 11:14:25 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:

> 05.05.2026 11:10, Miquel Raynal wrote:
>> On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>>
>>> 05.05.2026 10:50, Miquel Raynal wrote:
>>>> Hi,
>>>>
>>>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>>>>
>>>> Two important typos in the commit log :-)
>>>>
>>>>> 'cs' here must in range [0:nanddev_ntargets).
>>>>                 be                           [
>>>
>>> Hi, sorry, You mean?
>>>
>>>
>>> 'cs' here must be in range [0:nanddev_ntargets]. 
>> I meant [0:nanddev_ntargets[ which is the mathematical way, IIRC, to
>> indicate that the last value is out of scope/excluded.
>>
>> [0:nanddev_ntargets] means that nanddev_ntargets is included in the
>> scope of values and here since you are explicitly showing that it is
>> not, it feels wrong to use that convention.
>
>
> Ahh, Yes I see, just small misunderstood in math symbols:
>
> I mean: [A:B) == [A:B[
>
> https://wikimedia.org/api/rest_v1/media/math/render/svg/0719b1b08cdf649e735e6dab6dc7355fa37a9b21

Ah ok, didn't know that other convention, fine then, take the one you prefer if
both are identical. Just add the missing "be" please!

Thanks,
Miquèl

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

* Re: [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()'
  2026-05-05  8:23         ` Miquel Raynal
@ 2026-05-05 11:46           ` Arseniy Krasnov
  0 siblings, 0 replies; 7+ messages in thread
From: Arseniy Krasnov @ 2026-05-05 11:46 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, Vignesh Raghavendra, Frieder Schrempf,
	Boris Brezillon, linux-mtd, linux-kernel, rulkc, oxffffaa, stable


05.05.2026 11:23, Miquel Raynal wrote:
> On 05/05/2026 at 11:14:25 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>
>> 05.05.2026 11:10, Miquel Raynal wrote:
>>> On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>>>
>>>> 05.05.2026 10:50, Miquel Raynal wrote:
>>>>> Hi,
>>>>>
>>>>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov <avkrasnov@rulkc.org> wrote:
>>>>>
>>>>> Two important typos in the commit log :-)
>>>>>
>>>>>> 'cs' here must in range [0:nanddev_ntargets).
>>>>>                 be                           [
>>>> Hi, sorry, You mean?
>>>>
>>>>
>>>> 'cs' here must be in range [0:nanddev_ntargets]. 
>>> I meant [0:nanddev_ntargets[ which is the mathematical way, IIRC, to
>>> indicate that the last value is out of scope/excluded.
>>>
>>> [0:nanddev_ntargets] means that nanddev_ntargets is included in the
>>> scope of values and here since you are explicitly showing that it is
>>> not, it feels wrong to use that convention.
>>
>> Ahh, Yes I see, just small misunderstood in math symbols:
>>
>> I mean: [A:B) == [A:B[
>>
>> https://wikimedia.org/api/rest_v1/media/math/render/svg/0719b1b08cdf649e735e6dab6dc7355fa37a9b21
> Ah ok, didn't know that other convention, fine then, take the one you prefer if
> both are identical. Just add the missing "be" please!

Sure!

Thanks, Arseniy


>
> Thanks,
> Miquèl

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

end of thread, other threads:[~2026-05-05 11:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 22:10 [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' Arseniy Krasnov
2026-05-05  7:50 ` Miquel Raynal
2026-05-05  7:59   ` Arseniy Krasnov
2026-05-05  8:10     ` Miquel Raynal
2026-05-05  8:14       ` Arseniy Krasnov
2026-05-05  8:23         ` Miquel Raynal
2026-05-05 11:46           ` Arseniy Krasnov

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