Re: [PATCH] scsi: pmcraid: convert sysfs snprintf to sysfs_emit

From: Bart Van Assche
Date: Thu Apr 28 2022 - 23:43:08 EST


On 4/28/22 00:02, Xuezhi Zhang wrote:
Fix the following coccicheck warnings:
drivers/scsi/pmcraid.c:3591:8-16:
WARNING: use scnprintf or sprintf
drivers/scsi/pmcraid.c:3557:8-16:
WARNING: use scnprintf or sprintf
drivers/scsi/pmcraid.c:3496:8-16:
WARNING: use scnprintf or sprintf

I'm not sure the above is sufficient as motivation for this patch. The current code looks fine to me. Why to change the snprintf() calls into sysfs_emit() calls?

@@ -3554,8 +3554,7 @@ static ssize_t pmcraid_show_drv_version(
char *buf
)
{
- return snprintf(buf, PAGE_SIZE, "version: %s\n",
- PMCRAID_DRIVER_VERSION);
+ return sysfs_emt(buf, "version: %s\n", PMCRAID_DRIVER_VERSION);
}

Something tells me that this patch has not been tested at all - not even compile tested. Are you perhaps checking whether it is possible to get a broken patch in the kernel tree?

Bart.