[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVxxRXHCj35tbVTHVMn9NUVFmmHPzvP2Asd6GVuXmYJXQ@mail.gmail.com>
Date: Thu, 2 Jan 2025 21:14:58 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: John Madieu <john.madieu.xa@...renesas.com>
Cc: biju.das.jz@...renesas.com, claudiu.beznea.uj@...renesas.com,
conor+dt@...nel.org, devicetree@...r.kernel.org, geert+renesas@...der.be,
john.madieu@...il.com, krzk+dt@...nel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, magnus.damm@...il.com, robh@...nel.org
Subject: Re: [PATCH v2 2/4] soc: renesas: rz-sysc: Fix SoC ID string extraction
Hi John,
On Wed, Jan 1, 2025 at 5:34 PM John Madieu
<john.madieu.xa@...renesas.com> 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@...renesas.com>
> ---
> 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@...der.be>
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@bp.renesas.com
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
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
Powered by blists - more mailing lists