Re: [PATCH] powerpc: fsl_rio: Use snprintf() in fsl_rio_setup()
"Christophe Leroy (CS GROUP)" <[email protected]>
| Newsgroups | gmane.linux.ports.ppc.embedded |
|---|---|
| Message-ID | <44f93c64-55e9-4240-bc2c-be49280219f9__24586.7389648751$1786710402$gmane$org@kernel.org> |
Le 30/06/2026 à 16:49, Thorsten Blum a écrit : > While the current code works correctly, replace the unbounded sprintf() > with the safer snprintf() in fsl_rio_setup() to follow secure coding > best practices. > > Signed-off-by: Thorsten Blum <[email protected]> > --- > arch/powerpc/sysdev/fsl_rio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c > index eb55dabb4748..077c03cd93e4 100644 > --- a/arch/powerpc/sysdev/fsl_rio.c > +++ b/arch/powerpc/sysdev/fsl_rio.c > @@ -612,7 +612,7 @@ static int fsl_rio_setup(struct platform_device *dev) > kfree(port); > continue; > } > - sprintf(port->name, "RIO mport %d", i); > + snprintf(port->name, sizeof(port->name), "RIO mport %d", i); Are you sure it is correct ? Shouldn't it be sizeof(port->name) - 1 ? > > priv->dev = &dev->dev; > port->dev.parent = &dev->dev;