Re: [PATCH v2] scsi/qla4xxx: convert sysfs sprintf/snprintf family to sysfs_emit/sysfs_emit_at

From: Bart Van Assche
Date: Wed Jan 20 2021 - 23:57:39 EST


On 1/20/21 7:57 PM, Jiapeng Zhong wrote:
> - return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
> + return sysfs_emit_at(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
> ha->fw_info.fw_major, ha->fw_info.fw_minor,
> ha->fw_info.fw_patch, ha->fw_info.fw_build);

>From the sysfs_emit_at() source code:

WARN(... || at >= PAGE_SIZE, "invalid sysfs_emit_at: buf:%p at:%d\n",
buf, at)

In other words, this patch is wrong. sysfs_emit() should have been used
instead of sysfs_emit_at().

Bart.