linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy
@ 2022-08-18 21:01 Wolfram Sang
  2022-08-18 21:01 ` [PATCH 03/14] proc: " Wolfram Sang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Wolfram Sang @ 2022-08-18 21:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wolfram Sang, Hans de Goede, linux-fsdevel

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 fs/vboxsf/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c
index d2f6df69f611..1fb8f4df60cb 100644
--- a/fs/vboxsf/super.c
+++ b/fs/vboxsf/super.c
@@ -176,7 +176,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc)
 	}
 	folder_name->size = size;
 	folder_name->length = size - 1;
-	strlcpy(folder_name->string.utf8, fc->source, size);
+	strscpy(folder_name->string.utf8, fc->source, size);
 	err = vboxsf_map_folder(folder_name, &sbi->root);
 	kfree(folder_name);
 	if (err) {
-- 
2.35.1


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

* [PATCH 03/14] proc: move from strlcpy with unused retval to strscpy
  2022-08-18 21:01 [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy Wolfram Sang
@ 2022-08-18 21:01 ` Wolfram Sang
  2022-08-18 21:01 ` [PATCH 13/14] affs: " Wolfram Sang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2022-08-18 21:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wolfram Sang, linux-fsdevel

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 fs/proc/kcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index dff921f7ca33..9f61d5d405f5 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -422,7 +422,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
 		char *notes;
 		size_t i = 0;
 
-		strlcpy(prpsinfo.pr_psargs, saved_command_line,
+		strscpy(prpsinfo.pr_psargs, saved_command_line,
 			sizeof(prpsinfo.pr_psargs));
 
 		notes = kzalloc(notes_len, GFP_KERNEL);
-- 
2.35.1


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

* [PATCH 13/14] affs: move from strlcpy with unused retval to strscpy
  2022-08-18 21:01 [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy Wolfram Sang
  2022-08-18 21:01 ` [PATCH 03/14] proc: " Wolfram Sang
@ 2022-08-18 21:01 ` Wolfram Sang
  2022-08-18 21:01 ` [PATCH 14/14] fs: " Wolfram Sang
  2022-08-19  9:01 ` [PATCH 01/14] vboxsf: " Hans de Goede
  3 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2022-08-18 21:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wolfram Sang, David Sterba, linux-fsdevel

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 fs/affs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/affs/super.c b/fs/affs/super.c
index 4c5f30a83336..58b391446ae1 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -276,7 +276,7 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved,
 			char *vol = match_strdup(&args[0]);
 			if (!vol)
 				return 0;
-			strlcpy(volume, vol, 32);
+			strscpy(volume, vol, 32);
 			kfree(vol);
 			break;
 		}
-- 
2.35.1


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

* [PATCH 14/14] fs: move from strlcpy with unused retval to strscpy
  2022-08-18 21:01 [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy Wolfram Sang
  2022-08-18 21:01 ` [PATCH 03/14] proc: " Wolfram Sang
  2022-08-18 21:01 ` [PATCH 13/14] affs: " Wolfram Sang
@ 2022-08-18 21:01 ` Wolfram Sang
  2022-08-19  9:01 ` [PATCH 01/14] vboxsf: " Hans de Goede
  3 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2022-08-18 21:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Wolfram Sang, Alexander Viro, linux-fsdevel

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 fs/char_dev.c | 2 +-
 fs/super.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/char_dev.c b/fs/char_dev.c
index ba0ded7842a7..c6be63dfef04 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -150,7 +150,7 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
 	cd->major = major;
 	cd->baseminor = baseminor;
 	cd->minorct = minorct;
-	strlcpy(cd->name, name, sizeof(cd->name));
+	strscpy(cd->name, name, sizeof(cd->name));
 
 	if (!prev) {
 		cd->next = curr;
diff --git a/fs/super.c b/fs/super.c
index 734ed584a946..708569341fe5 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -573,7 +573,7 @@ struct super_block *sget_fc(struct fs_context *fc,
 	fc->s_fs_info = NULL;
 	s->s_type = fc->fs_type;
 	s->s_iflags |= fc->s_iflags;
-	strlcpy(s->s_id, s->s_type->name, sizeof(s->s_id));
+	strscpy(s->s_id, s->s_type->name, sizeof(s->s_id));
 	list_add_tail(&s->s_list, &super_blocks);
 	hlist_add_head(&s->s_instances, &s->s_type->fs_supers);
 	spin_unlock(&sb_lock);
@@ -652,7 +652,7 @@ struct super_block *sget(struct file_system_type *type,
 		return ERR_PTR(err);
 	}
 	s->s_type = type;
-	strlcpy(s->s_id, type->name, sizeof(s->s_id));
+	strscpy(s->s_id, type->name, sizeof(s->s_id));
 	list_add_tail(&s->s_list, &super_blocks);
 	hlist_add_head(&s->s_instances, &type->fs_supers);
 	spin_unlock(&sb_lock);
-- 
2.35.1


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

* Re: [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy
  2022-08-18 21:01 [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy Wolfram Sang
                   ` (2 preceding siblings ...)
  2022-08-18 21:01 ` [PATCH 14/14] fs: " Wolfram Sang
@ 2022-08-19  9:01 ` Hans de Goede
  2022-08-20  8:18   ` Wolfram Sang
  3 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2022-08-19  9:01 UTC (permalink / raw)
  To: Wolfram Sang, linux-kernel; +Cc: linux-fsdevel

Hi,

On 8/18/22 23:01, Wolfram Sang wrote:
> Follow the advice of the below link and prefer 'strscpy' in this
> subsystem. Conversion is 1:1 because the return value is not used.
> Generated by a coccinelle script.
> 
> Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Note you send this one twice. Since I'm not sure which one
will end up getting merged, I'm going to just reply to both...

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  fs/vboxsf/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c
> index d2f6df69f611..1fb8f4df60cb 100644
> --- a/fs/vboxsf/super.c
> +++ b/fs/vboxsf/super.c
> @@ -176,7 +176,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc)
>  	}
>  	folder_name->size = size;
>  	folder_name->length = size - 1;
> -	strlcpy(folder_name->string.utf8, fc->source, size);
> +	strscpy(folder_name->string.utf8, fc->source, size);
>  	err = vboxsf_map_folder(folder_name, &sbi->root);
>  	kfree(folder_name);
>  	if (err) {


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

* Re: [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy
  2022-08-19  9:01 ` [PATCH 01/14] vboxsf: " Hans de Goede
@ 2022-08-20  8:18   ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2022-08-20  8:18 UTC (permalink / raw)
  To: Hans de Goede; +Cc: linux-kernel, linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]


> Note you send this one twice. Since I'm not sure which one
> will end up getting merged, I'm going to just reply to both...

Ouch, yes, I sent out all subfolders in fs/ twice. Will fix my scripts,
I am sorry for the noise!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-08-20  8:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-18 21:01 [PATCH 01/14] vboxsf: move from strlcpy with unused retval to strscpy Wolfram Sang
2022-08-18 21:01 ` [PATCH 03/14] proc: " Wolfram Sang
2022-08-18 21:01 ` [PATCH 13/14] affs: " Wolfram Sang
2022-08-18 21:01 ` [PATCH 14/14] fs: " Wolfram Sang
2022-08-19  9:01 ` [PATCH 01/14] vboxsf: " Hans de Goede
2022-08-20  8:18   ` Wolfram Sang

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).