From avkrasnov at rulkc.org Tue May 5 01:10:12 2026 From: avkrasnov at rulkc.org (Arseniy Krasnov) Date: Tue, 5 May 2026 01:10:12 +0300 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' Message-ID: <20260504221012.1310605-1-avkrasnov@rulkc.org> 'cs' here must in range [0:nanddev_ntargets). Cc: stable at vger.kernel.org Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips") Signed-off-by: Arseniy Krasnov --- 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 From miquel.raynal at bootlin.com Tue May 5 10:50:19 2026 From: miquel.raynal at bootlin.com (Miquel Raynal) Date: Tue, 05 May 2026 09:50:19 +0200 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' In-Reply-To: <20260504221012.1310605-1-avkrasnov@rulkc.org> (Arseniy Krasnov's message of "Tue, 5 May 2026 01:10:12 +0300") References: <20260504221012.1310605-1-avkrasnov@rulkc.org> Message-ID: <87mryeqoqs.fsf@bootlin.com> Hi, On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov wrote: Two important typos in the commit log :-) > 'cs' here must in range [0:nanddev_ntargets). be [ Thanks, Miqu?l From avkrasnov at rulkc.org Tue May 5 10:59:16 2026 From: avkrasnov at rulkc.org (Arseniy Krasnov) Date: Tue, 5 May 2026 10:59:16 +0300 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' In-Reply-To: <87mryeqoqs.fsf@bootlin.com> References: <20260504221012.1310605-1-avkrasnov@rulkc.org> <87mryeqoqs.fsf@bootlin.com> Message-ID: <57b0cc2a-6d62-405c-bfa5-68d1c46dbad9@rulkc.org> 05.05.2026 10:50, Miquel Raynal wrote: > Hi, > > On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov 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 From miquel.raynal at bootlin.com Tue May 5 11:10:06 2026 From: miquel.raynal at bootlin.com (Miquel Raynal) Date: Tue, 05 May 2026 10:10:06 +0200 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' In-Reply-To: <57b0cc2a-6d62-405c-bfa5-68d1c46dbad9@rulkc.org> (Arseniy Krasnov's message of "Tue, 5 May 2026 10:59:16 +0300") References: <20260504221012.1310605-1-avkrasnov@rulkc.org> <87mryeqoqs.fsf@bootlin.com> <57b0cc2a-6d62-405c-bfa5-68d1c46dbad9@rulkc.org> Message-ID: <87h5omqntt.fsf@bootlin.com> On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov wrote: > 05.05.2026 10:50, Miquel Raynal wrote: >> Hi, >> >> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov 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 From avkrasnov at rulkc.org Tue May 5 11:14:25 2026 From: avkrasnov at rulkc.org (Arseniy Krasnov) Date: Tue, 5 May 2026 11:14:25 +0300 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' In-Reply-To: <87h5omqntt.fsf@bootlin.com> References: <20260504221012.1310605-1-avkrasnov@rulkc.org> <87mryeqoqs.fsf@bootlin.com> <57b0cc2a-6d62-405c-bfa5-68d1c46dbad9@rulkc.org> <87h5omqntt.fsf@bootlin.com> Message-ID: <335fad03-6113-4508-b28d-b21c7efcffe6@rulkc.org> 05.05.2026 11:10, Miquel Raynal wrote: > On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov wrote: > >> 05.05.2026 10:50, Miquel Raynal wrote: >>> Hi, >>> >>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov 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 From miquel.raynal at bootlin.com Tue May 5 11:23:55 2026 From: miquel.raynal at bootlin.com (Miquel Raynal) Date: Tue, 05 May 2026 10:23:55 +0200 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' In-Reply-To: <335fad03-6113-4508-b28d-b21c7efcffe6@rulkc.org> (Arseniy Krasnov's message of "Tue, 5 May 2026 11:14:25 +0300") References: <20260504221012.1310605-1-avkrasnov@rulkc.org> <87mryeqoqs.fsf@bootlin.com> <57b0cc2a-6d62-405c-bfa5-68d1c46dbad9@rulkc.org> <87h5omqntt.fsf@bootlin.com> <335fad03-6113-4508-b28d-b21c7efcffe6@rulkc.org> Message-ID: <87bjeuqn6s.fsf@bootlin.com> On 05/05/2026 at 11:14:25 +03, Arseniy Krasnov wrote: > 05.05.2026 11:10, Miquel Raynal wrote: >> On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov wrote: >> >>> 05.05.2026 10:50, Miquel Raynal wrote: >>>> Hi, >>>> >>>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov 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 From avkrasnov at rulkc.org Tue May 5 11:30:30 2026 From: avkrasnov at rulkc.org (Arseniy Krasnov) Date: Tue, 5 May 2026 11:30:30 +0300 Subject: [rulkc] [PATCH v2] mtd: rawnand: fix condition in 'nand_select_target()' Message-ID: <20260505083030.322528-1-avkrasnov@rulkc.org> 'cs' here must be in range [0:nanddev_ntargets[. Cc: stable at vger.kernel.org Fixes: 32813e288414 ("mtd: rawnand: Get rid of chip->numchips") Signed-off-by: Arseniy Krasnov --- Changelog v1->v2: * Commit message typo updates. 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 From avkrasnov at rulkc.org Tue May 5 14:46:21 2026 From: avkrasnov at rulkc.org (Arseniy Krasnov) Date: Tue, 5 May 2026 14:46:21 +0300 Subject: [rulkc] [PATCH v1] mtd: rawnand: fix condition in 'nand_select_target()' In-Reply-To: <87bjeuqn6s.fsf@bootlin.com> References: <20260504221012.1310605-1-avkrasnov@rulkc.org> <87mryeqoqs.fsf@bootlin.com> <57b0cc2a-6d62-405c-bfa5-68d1c46dbad9@rulkc.org> <87h5omqntt.fsf@bootlin.com> <335fad03-6113-4508-b28d-b21c7efcffe6@rulkc.org> <87bjeuqn6s.fsf@bootlin.com> Message-ID: 05.05.2026 11:23, Miquel Raynal wrote: > On 05/05/2026 at 11:14:25 +03, Arseniy Krasnov wrote: > >> 05.05.2026 11:10, Miquel Raynal wrote: >>> On 05/05/2026 at 10:59:16 +03, Arseniy Krasnov wrote: >>> >>>> 05.05.2026 10:50, Miquel Raynal wrote: >>>>> Hi, >>>>> >>>>> On 05/05/2026 at 01:10:12 +03, Arseniy Krasnov 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