Message ID | 20220112174612.10773-11-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Kieran Bingham |
Headers | show |
Series | Add RZ/G2L Display support | expand |
Hi Biju, On Wed, Jan 12, 2022 at 6:46 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > Increase buff size for compatible variable to avoid stack corruption > with RZ/G2L SoC's(renesas,du-r9a07g044l) which requires a buff size > more than the current allocated size. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Thanks for your patch! > --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c > @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids) > struct device_node *lvds_node; > struct device_node *soc_node; > struct device_node *du_node; > - char compatible[22]; > + char compatible[24]; > const char *soc_name; > unsigned int i; > int ret; What about changing the code to use kasprintf() instead, to prevent this from ever happening again? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-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
Hi Geert, Thanks for the feedback. > Subject: Re: [RFC 10/28] drm: rcar-du: of: Increase buff size for > compatible variable > > Hi Biju, > > On Wed, Jan 12, 2022 at 6:46 PM Biju Das <biju.das.jz@bp.renesas.com> > wrote: > > Increase buff size for compatible variable to avoid stack corruption > > with RZ/G2L SoC's(renesas,du-r9a07g044l) which requires a buff size > > more than the current allocated size. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Thanks for your patch! > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c > > @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const > struct of_device_id *of_ids) > > struct device_node *lvds_node; > > struct device_node *soc_node; > > struct device_node *du_node; > > - char compatible[22]; > > + char compatible[24]; > > const char *soc_name; > > unsigned int i; > > int ret; > > What about changing the code to use kasprintf() instead, to prevent this > from ever happening again? OK. Will try to use kasprintf. It took some time to figure out the original corruption issue with RZ/G2L, where string length "socname-lvds" is beyond the limit. Regards, Biju
On Fri, Jan 14, 2022 at 11:17:19AM +0100, Geert Uytterhoeven wrote: > On Wed, Jan 12, 2022 at 6:46 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > Increase buff size for compatible variable to avoid stack corruption > > with RZ/G2L SoC's(renesas,du-r9a07g044l) which requires a buff size > > more than the current allocated size. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Thanks for your patch! > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c > > @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids) > > struct device_node *lvds_node; > > struct device_node *soc_node; > > struct device_node *du_node; > > - char compatible[22]; > > + char compatible[24]; > > const char *soc_name; > > unsigned int i; > > int ret; > > What about changing the code to use kasprintf() instead, to prevent > this from ever happening again? Or maybe it's time to drop this backward compatibility code altogether ?
Hi Laurent, On Sun, Jan 23, 2022 at 2:52 PM Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > On Fri, Jan 14, 2022 at 11:17:19AM +0100, Geert Uytterhoeven wrote: > > On Wed, Jan 12, 2022 at 6:46 PM Biju Das <biju.das.jz@bp.renesas.com> wrote: > > > Increase buff size for compatible variable to avoid stack corruption > > > with RZ/G2L SoC's(renesas,du-r9a07g044l) which requires a buff size > > > more than the current allocated size. > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > > Thanks for your patch! > > > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c > > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c > > > @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids) > > > struct device_node *lvds_node; > > > struct device_node *soc_node; > > > struct device_node *du_node; > > > - char compatible[22]; > > > + char compatible[24]; > > > const char *soc_name; > > > unsigned int i; > > > int ret; > > > > What about changing the code to use kasprintf() instead, to prevent > > this from ever happening again? > > Or maybe it's time to drop this backward compatibility code altogether ? The last R-Car Gen2 DTS was converted in commit edb0c3affe5214a2 ("ARM: dts: r8a7793: Convert to new LVDS DT bindings") in v4.17. The last RZ/G1 DTS was converted in commit 6a6a797625b5fe85 ("ARM: dts: r8a7743: Convert to new LVDS DT bindings") in v5.0. Both are older than commit 58256143cff7c2e0 ("clk: renesas: Remove R-Car Gen2 legacy DT clock support") in v5.5, so I'd say let's get rid of it. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-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
Hi Geert, On Mon, Jan 24, 2022 at 09:18:52AM +0100, Geert Uytterhoeven wrote: > On Sun, Jan 23, 2022 at 2:52 PM Laurent Pinchart wrote: > > On Fri, Jan 14, 2022 at 11:17:19AM +0100, Geert Uytterhoeven wrote: > > > On Wed, Jan 12, 2022 at 6:46 PM Biju Das wrote: > > > > Increase buff size for compatible variable to avoid stack corruption > > > > with RZ/G2L SoC's(renesas,du-r9a07g044l) which requires a buff size > > > > more than the current allocated size. > > > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > > > > Thanks for your patch! > > > > > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c > > > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c > > > > @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids) > > > > struct device_node *lvds_node; > > > > struct device_node *soc_node; > > > > struct device_node *du_node; > > > > - char compatible[22]; > > > > + char compatible[24]; > > > > const char *soc_name; > > > > unsigned int i; > > > > int ret; > > > > > > What about changing the code to use kasprintf() instead, to prevent > > > this from ever happening again? > > > > Or maybe it's time to drop this backward compatibility code altogether ? > > The last R-Car Gen2 DTS was converted in commit edb0c3affe5214a2 > ("ARM: dts: r8a7793: Convert to new LVDS DT bindings") in v4.17. > The last RZ/G1 DTS was converted in commit 6a6a797625b5fe85 ("ARM: > dts: r8a7743: Convert to new LVDS DT bindings") in v5.0. > > Both are older than commit 58256143cff7c2e0 ("clk: renesas: Remove > R-Car Gen2 legacy DT clock support") in v5.5, so I'd say let's get > rid of it. Let's do so then. Biju, would you drop the compat code in v2, or would you like me to send patches ?
Hi Laurent, > Subject: Re: [RFC 10/28] drm: rcar-du: of: Increase buff size for > compatible variable > > Hi Geert, > > On Mon, Jan 24, 2022 at 09:18:52AM +0100, Geert Uytterhoeven wrote: > > On Sun, Jan 23, 2022 at 2:52 PM Laurent Pinchart wrote: > > > On Fri, Jan 14, 2022 at 11:17:19AM +0100, Geert Uytterhoeven wrote: > > > > On Wed, Jan 12, 2022 at 6:46 PM Biju Das wrote: > > > > > Increase buff size for compatible variable to avoid stack > > > > > corruption with RZ/G2L SoC's(renesas,du-r9a07g044l) which > > > > > requires a buff size more than the current allocated size. > > > > > > > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > > > > > > > Thanks for your patch! > > > > > > > > > --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c > > > > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c > > > > > @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const > struct of_device_id *of_ids) > > > > > struct device_node *lvds_node; > > > > > struct device_node *soc_node; > > > > > struct device_node *du_node; > > > > > - char compatible[22]; > > > > > + char compatible[24]; > > > > > const char *soc_name; > > > > > unsigned int i; > > > > > int ret; > > > > > > > > What about changing the code to use kasprintf() instead, to > > > > prevent this from ever happening again? > > > > > > Or maybe it's time to drop this backward compatibility code altogether > ? > > > > The last R-Car Gen2 DTS was converted in commit edb0c3affe5214a2 > > ("ARM: dts: r8a7793: Convert to new LVDS DT bindings") in v4.17. > > The last RZ/G1 DTS was converted in commit 6a6a797625b5fe85 ("ARM: > > dts: r8a7743: Convert to new LVDS DT bindings") in v5.0. > > > > Both are older than commit 58256143cff7c2e0 ("clk: renesas: Remove > > R-Car Gen2 legacy DT clock support") in v5.5, so I'd say let's get rid > > of it. > > Let's do so then. Biju, would you drop the compat code in v2, or would you > like me to send patches ? Please drop this patch and feel free to send patches, as I am busy with bring up of RZ/G2UL SoC. Regards, Biju
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_of.c b/drivers/gpu/drm/rcar-du/rcar_du_of.c index afef69669bb4..84e73f8df686 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_of.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c @@ -200,7 +200,7 @@ static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids) struct device_node *lvds_node; struct device_node *soc_node; struct device_node *du_node; - char compatible[22]; + char compatible[24]; const char *soc_name; unsigned int i; int ret;
Increase buff size for compatible variable to avoid stack corruption with RZ/G2L SoC's(renesas,du-r9a07g044l) which requires a buff size more than the current allocated size. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/gpu/drm/rcar-du/rcar_du_of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)