Re: [PATCH] zorro: sysfs: replace sprintf with sysfs_emit
Geert Uytterhoeven <[email protected]>
| Newsgroups | org.kernel.vger.linux-m68k,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAMuHMdU9D7i5ty5Gdj=ynuezwLJg6qH3-rV7Kp1AWVv-7Maw1Q@mail.gmail.com> |
Hi Stefan, On Mon, 6 Apr 2026 at 19:26, Stefan Pedratscher <[email protected]> wrote: > Convert sysfs show functions from sprintf to sysfs_emit as recommended > by Documentation/filesystems/sysfs.rst. This ensures proper buffer > handling and avoids potential buffer overflows. > > Signed-off-by: Stefan Pedratscher <[email protected]> Thanks for your patch! > --- a/drivers/zorro/zorro-sysfs.c > +++ b/drivers/zorro/zorro-sysfs.c > @@ -53,10 +54,10 @@ static ssize_t resource_show(struct device *dev, struct device_attribute *attr, > { > struct zorro_dev *z = to_zorro_dev(dev); > > - return sprintf(buf, "0x%08lx 0x%08lx 0x%08lx\n", > - (unsigned long)zorro_resource_start(z), > - (unsigned long)zorro_resource_end(z), > - zorro_resource_flags(z)); > + return sysfs_emit(buf, "0x%08lx 0x%08lx 0x%08lx\n", > + (unsigned long)zorro_resource_start(z), > + (unsigned long)zorro_resource_end(z), > + zorro_resource_flags(z)); Wrong indentation. > } > static DEVICE_ATTR_RO(resource); > The rest LGTM, so Reviewed-by: Geert Uytterhoeven <[email protected]> i.e. will queue in the m68k tree for v7.2, with the above fixed. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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