* [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs
@ 2020-07-17 8:44 Xiongfeng Wang
2020-07-18 20:25 ` Bart Van Assche
2020-07-21 3:42 ` Martin K. Petersen
0 siblings, 2 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2020-07-17 8:44 UTC (permalink / raw)
To: jejb, martin.petersen, john.garry
Cc: linux-scsi, linux-kernel, guohanjun, wangxiongfeng2
When I cat sysfs file 'enable' below 'sas_phy', it displays as follows.
It's better to add a newline for easy reading.
[root@localhost ~]# cat /sys/devices/pci0000:00/0000:00:0d.0/0000:0f:00.0/host3/phy-3:2/sas_phy/phy-3:2/enable
1[root@localhost ~]#
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
---
v1 -> v2:
modify commit subject.
add Reviewed-by tag.
---
drivers/scsi/scsi_transport_sas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 182fd25..e443dee 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -563,7 +563,7 @@ static ssize_t do_sas_phy_enable(struct device *dev,
{
struct sas_phy *phy = transport_class_to_phy(dev);
- return snprintf(buf, 20, "%d", phy->enabled);
+ return snprintf(buf, 20, "%d\n", phy->enabled);
}
static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable,
--
1.7.12.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs
2020-07-17 8:44 [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs Xiongfeng Wang
@ 2020-07-18 20:25 ` Bart Van Assche
2020-07-20 2:07 ` Xiongfeng Wang
2020-07-21 3:42 ` Martin K. Petersen
1 sibling, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2020-07-18 20:25 UTC (permalink / raw)
To: Xiongfeng Wang, jejb, martin.petersen, john.garry
Cc: linux-scsi, linux-kernel, guohanjun
On 2020-07-17 01:44, Xiongfeng Wang wrote:
> diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
> index 182fd25..e443dee 100644
> --- a/drivers/scsi/scsi_transport_sas.c
> +++ b/drivers/scsi/scsi_transport_sas.c
> @@ -563,7 +563,7 @@ static ssize_t do_sas_phy_enable(struct device *dev,
> {
> struct sas_phy *phy = transport_class_to_phy(dev);
>
> - return snprintf(buf, 20, "%d", phy->enabled);
> + return snprintf(buf, 20, "%d\n", phy->enabled);
> }
For future sysfs show function patches, please use PAGE_SIZE as second
snprintf() argument or use sprintf() instead of snprintf() because in
this case it is clear that no output buffer overflow will happen. Using
any other size argument than PAGE_SIZE makes patches like the above
harder to verify than necessary. Anyway:
Reviewed-by: Bart van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs
2020-07-18 20:25 ` Bart Van Assche
@ 2020-07-20 2:07 ` Xiongfeng Wang
0 siblings, 0 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2020-07-20 2:07 UTC (permalink / raw)
To: Bart Van Assche, jejb, martin.petersen, john.garry
Cc: linux-scsi, linux-kernel, guohanjun
Hi,
On 2020/7/19 4:25, Bart Van Assche wrote:
> On 2020-07-17 01:44, Xiongfeng Wang wrote:
>> diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
>> index 182fd25..e443dee 100644
>> --- a/drivers/scsi/scsi_transport_sas.c
>> +++ b/drivers/scsi/scsi_transport_sas.c
>> @@ -563,7 +563,7 @@ static ssize_t do_sas_phy_enable(struct device *dev,
>> {
>> struct sas_phy *phy = transport_class_to_phy(dev);
>>
>> - return snprintf(buf, 20, "%d", phy->enabled);
>> + return snprintf(buf, 20, "%d\n", phy->enabled);
>> }
>
> For future sysfs show function patches, please use PAGE_SIZE as second
> snprintf() argument or use sprintf() instead of snprintf() because in
> this case it is clear that no output buffer overflow will happen. Using
Thanks for your advice. I will follow it in the future patches.
> any other size argument than PAGE_SIZE makes patches like the above
> harder to verify than necessary. Anyway:
>
> Reviewed-by: Bart van Assche <bvanassche@acm.org>
Thanks,
Xiongfeng
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs
2020-07-17 8:44 [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs Xiongfeng Wang
2020-07-18 20:25 ` Bart Van Assche
@ 2020-07-21 3:42 ` Martin K. Petersen
1 sibling, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-07-21 3:42 UTC (permalink / raw)
To: jejb, john.garry, Xiongfeng Wang
Cc: Martin K . Petersen, linux-scsi, linux-kernel, guohanjun
On Fri, 17 Jul 2020 16:44:32 +0800, Xiongfeng Wang wrote:
> When I cat sysfs file 'enable' below 'sas_phy', it displays as follows.
> It's better to add a newline for easy reading.
>
> [root@localhost ~]# cat /sys/devices/pci0000:00/0000:00:0d.0/0000:0f:00.0/host3/phy-3:2/sas_phy/phy-3:2/enable
> 1[root@localhost ~]#
Applied to 5.9/scsi-queue, thanks!
[1/1] scsi: scsi_transport_sas: Add missing newline in sysfs 'enable' attribute
https://git.kernel.org/mkp/scsi/c/38364267251f
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-21 3:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 8:44 [PATCH v2] scsi: scsi_transport_sas: add missing newline when printing 'enable' by sysfs Xiongfeng Wang
2020-07-18 20:25 ` Bart Van Assche
2020-07-20 2:07 ` Xiongfeng Wang
2020-07-21 3:42 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).