All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dlmfs: add a newline when printing 'capabilities' by sysfs
@ 2020-07-20  8:24 ` Xiongfeng Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2020-07-20  8:24 UTC (permalink / raw)
  To: mark, jlbec, joseph.qi; +Cc: ocfs2-devel, linux-kernel, wangxiongfeng2

When I cat module parameter 'capabilities' by sysfs, it displays as
follows. It's better to add a newline for easy reading.

root@syzkaller:~# cat /sys/module/ocfs2_dlmfs/parameters/capabilities
bast stackglueroot@syzkaller:~#

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 fs/ocfs2/dlmfs/dlmfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index ea868c6f9800..1f9c864ec09b 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -82,8 +82,13 @@ static int param_set_dlmfs_capabilities(const char *val,
 static int param_get_dlmfs_capabilities(char *buffer,
 					const struct kernel_param *kp)
 {
-	return strlcpy(buffer, DLMFS_CAPABILITIES,
+	int cnt;
+
+	cnt = strlcpy(buffer, DLMFS_CAPABILITIES,
 		       strlen(DLMFS_CAPABILITIES) + 1);
+	cnt += sprintf(buffer + cnt, "\n");
+
+	return cnt;
 }
 module_param_call(capabilities, param_set_dlmfs_capabilities,
 		  param_get_dlmfs_capabilities, NULL, 0444);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH] dlmfs: add a newline when printing 'capabilities' by sysfs
@ 2020-07-20  8:24 ` Xiongfeng Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Xiongfeng Wang @ 2020-07-20  8:24 UTC (permalink / raw)
  To: mark, jlbec, joseph.qi; +Cc: ocfs2-devel, linux-kernel, wangxiongfeng2

When I cat module parameter 'capabilities' by sysfs, it displays as
follows. It's better to add a newline for easy reading.

root at syzkaller:~# cat /sys/module/ocfs2_dlmfs/parameters/capabilities
bast stackglueroot at syzkaller:~#

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 fs/ocfs2/dlmfs/dlmfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index ea868c6f9800..1f9c864ec09b 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -82,8 +82,13 @@ static int param_set_dlmfs_capabilities(const char *val,
 static int param_get_dlmfs_capabilities(char *buffer,
 					const struct kernel_param *kp)
 {
-	return strlcpy(buffer, DLMFS_CAPABILITIES,
+	int cnt;
+
+	cnt = strlcpy(buffer, DLMFS_CAPABILITIES,
 		       strlen(DLMFS_CAPABILITIES) + 1);
+	cnt += sprintf(buffer + cnt, "\n");
+
+	return cnt;
 }
 module_param_call(capabilities, param_set_dlmfs_capabilities,
 		  param_get_dlmfs_capabilities, NULL, 0444);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Ocfs2-devel] [PATCH] dlmfs: add a newline when printing 'capabilities' by sysfs
  2020-07-20  8:24 ` [Ocfs2-devel] " Xiongfeng Wang
@ 2020-07-21  2:24   ` Changwei Ge
  -1 siblings, 0 replies; 4+ messages in thread
From: Changwei Ge @ 2020-07-21  2:24 UTC (permalink / raw)
  To: Xiongfeng Wang, mark, jlbec, joseph.qi; +Cc: linux-kernel, ocfs2-devel

Hi,

I am afraid that doing so might introduce a compatible risk into exited 
systems which reply ocfs2/dlmfs.

We can't guarantee that no system management tools is using the 
information reported from this file.

Basically, ocfs2-tools works of top of it. But after a quick glance at 
the source, I didn't see side effect if this path applied. Better you 
can do some test if this patch breaks ocfs2-tools.

Still my suggestion is that we don't try to touch this file as what I 
explained above.

Thanks,
Changwei


On 7/20/20 4:24 PM, Xiongfeng Wang wrote:
> When I cat module parameter 'capabilities' by sysfs, it displays as
> follows. It's better to add a newline for easy reading.
> 
> root@syzkaller:~# cat /sys/module/ocfs2_dlmfs/parameters/capabilities
> bast stackglueroot@syzkaller:~#
> 
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
>   fs/ocfs2/dlmfs/dlmfs.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
> index ea868c6f9800..1f9c864ec09b 100644
> --- a/fs/ocfs2/dlmfs/dlmfs.c
> +++ b/fs/ocfs2/dlmfs/dlmfs.c
> @@ -82,8 +82,13 @@ static int param_set_dlmfs_capabilities(const char *val,
>   static int param_get_dlmfs_capabilities(char *buffer,
>   					const struct kernel_param *kp)
>   {
> -	return strlcpy(buffer, DLMFS_CAPABILITIES,
> +	int cnt;
> +
> +	cnt = strlcpy(buffer, DLMFS_CAPABILITIES,
>   		       strlen(DLMFS_CAPABILITIES) + 1);
> +	cnt += sprintf(buffer + cnt, "\n");
> +
> +	return cnt;
>   }
>   module_param_call(capabilities, param_set_dlmfs_capabilities,
>   		  param_get_dlmfs_capabilities, NULL, 0444);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH] dlmfs: add a newline when printing 'capabilities' by sysfs
@ 2020-07-21  2:24   ` Changwei Ge
  0 siblings, 0 replies; 4+ messages in thread
From: Changwei Ge @ 2020-07-21  2:24 UTC (permalink / raw)
  To: Xiongfeng Wang, mark, jlbec, joseph.qi; +Cc: linux-kernel, ocfs2-devel

Hi?

I am afraid that doing so might introduce a compatible risk into exited 
systems which reply ocfs2/dlmfs.

We can't guarantee that no system management tools is using the 
information reported from this file.

Basically, ocfs2-tools works of top of it. But after a quick glance at 
the source, I didn't see side effect if this path applied. Better you 
can do some test if this patch breaks ocfs2-tools.

Still my suggestion is that we don't try to touch this file as what I 
explained above.

Thanks,
Changwei


On 7/20/20 4:24 PM, Xiongfeng Wang wrote:
> When I cat module parameter 'capabilities' by sysfs, it displays as
> follows. It's better to add a newline for easy reading.
> 
> root at syzkaller:~# cat /sys/module/ocfs2_dlmfs/parameters/capabilities
> bast stackglueroot at syzkaller:~#
> 
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
>   fs/ocfs2/dlmfs/dlmfs.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
> index ea868c6f9800..1f9c864ec09b 100644
> --- a/fs/ocfs2/dlmfs/dlmfs.c
> +++ b/fs/ocfs2/dlmfs/dlmfs.c
> @@ -82,8 +82,13 @@ static int param_set_dlmfs_capabilities(const char *val,
>   static int param_get_dlmfs_capabilities(char *buffer,
>   					const struct kernel_param *kp)
>   {
> -	return strlcpy(buffer, DLMFS_CAPABILITIES,
> +	int cnt;
> +
> +	cnt = strlcpy(buffer, DLMFS_CAPABILITIES,
>   		       strlen(DLMFS_CAPABILITIES) + 1);
> +	cnt += sprintf(buffer + cnt, "\n");
> +
> +	return cnt;
>   }
>   module_param_call(capabilities, param_set_dlmfs_capabilities,
>   		  param_get_dlmfs_capabilities, NULL, 0444);
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-21  2:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20  8:24 [PATCH] dlmfs: add a newline when printing 'capabilities' by sysfs Xiongfeng Wang
2020-07-20  8:24 ` [Ocfs2-devel] " Xiongfeng Wang
2020-07-21  2:24 ` Changwei Ge
2020-07-21  2:24   ` Changwei Ge

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.