Hi John, On Wed, Jan 1, 2025 at 5:34 PM John Madieu <john.madieu.xa@xxxxxxxxxxxxxx> wrote: > Fix string length calculation when extracting the SoC ID from the compatible > string. Add +1 to the size calculation to ensure proper string termination when > copying with strncpy(). > > This prevents potential string trunctation when processing the device tree > compatible string to identify the SoC. > > Signed-off-by: John Madieu <john.madieu.xa@xxxxxxxxxxxxxx> > --- > New patch introduced in v2, targetting specific fix. Thanks for your patch! > --- a/drivers/soc/renesas/rz-sysc.c > +++ b/drivers/soc/renesas/rz-sysc.c > @@ -231,7 +231,7 @@ static int rz_sysc_soc_init(struct rz_sysc *sysc, const struct of_device_id *mat > > soc_id_start = strchr(match->compatible, ',') + 1; > soc_id_end = strchr(match->compatible, '-'); > - size = soc_id_end - soc_id_start; > + size = soc_id_end - soc_id_start + 1; > if (size > 32) > size = 32; > strscpy(soc_id, soc_id_start, size); Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> As the code fixed was introduced by a patch[1] that has not been accepted yet, this fix should be incorporated into the original patch (together with other fixes according to review comments). [1] "[PATCH v2 04/15] soc: renesas: rz-sysc: Add SoC detection support" https://lore.kernel.org/linux-renesas-soc/20241126092050.1825607-5-claudiu.beznea.uj@xxxxxxxxxxxxxx Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds