[PATCH] mtd: core: Convert sysfs sprintf/snprintf family to sysfs_emit

Richard Weinberger richard at nod.at
Mon Apr 12 09:07:52 BST 2021


----- Ursprüngliche Mail -----
>>> Fix the following coccicheck warning:
>>> drivers/mtd/mtdcore.c:296:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:306:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:237:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:275:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:286:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:264:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:227:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:162:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:143:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:218:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:208:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:199:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:190:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:152:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:181:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:134:8-16: WARNING: use scnprintf or sprintf
>>> drivers/mtd/mtdcore.c:171:8-16: WARNING: use scnprintf or sprintf

>> see: [
>> https://lore.kernel.org/linux-mtd/CAFLxGvxC4KtvtU2rza_aGx2RPONxr7XygUwXCDriYiCr8qN3qg@mail.gmail.com/
>> |
>> https://lore.kernel.org/linux-mtd/CAFLxGvxC4KtvtU2rza_aGx2RPONxr7XygUwXCDriYiCr8qN3qg@mail.gmail.com/
>> ] Please explain why a patch is needed and what it fixes.

> Using syfs_emit will avoid buffer overrun by avoiding buf being null or buf
> being in the middle of the page.

> no function change.

All this needs to go into the commit message.
Like I said, please explain changes.

The coccicheck warning in the commit message is also close to useless because
it advises you to use scnprintf or sprintf, which is not what your patch does.

Thanks,
//richard



More information about the linux-mtd mailing list