mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] m68k/kernel: replace strncpy() with strscpy()
@ 2025-04-03 18:11 Mohammad Mahdi Anbaraki
  2025-04-22 18:00 ` mohammad mahdi anbaraki
  2025-04-27 23:42 ` Greg Ungerer
  0 siblings, 2 replies; 3+ messages in thread
From: Mohammad Mahdi Anbaraki @ 2025-04-03 18:11 UTC (permalink / raw)
  To: geert; +Cc: linux-m68k, linux-kernel, Mohammad Mahdi Anbaraki

Swapped out strncpy() for strscpy() in parse_uboot_commandline() while
copying to commandp. strscpy() makes sure the string is properly null-
terminated and gives a more useful return value so it's just a safer 
choice overall.

Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Mohammad Mahdi Anbaraki <m.mahdianbaraki@gmail.com>
---
Changes in v2:
- s/m64/m68

 arch/m68k/kernel/uboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
index 5e52ea150..fa7c279ea 100644
--- a/arch/m68k/kernel/uboot.c
+++ b/arch/m68k/kernel/uboot.c
@@ -73,7 +73,7 @@ static void __init parse_uboot_commandline(char *commandp, int size)
 	uboot_cmd_end = sp[5];
 
 	if (uboot_cmd_start && uboot_cmd_end)
-		strncpy(commandp, (const char *)uboot_cmd_start, size);
+		strscpy(commandp, (const char *)uboot_cmd_start, size);
 
 #if defined(CONFIG_BLK_DEV_INITRD)
 	uboot_initrd_start = sp[2];
-- 
2.43.0


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

* Re: [PATCH v2] m68k/kernel: replace strncpy() with strscpy()
  2025-04-03 18:11 [PATCH v2] m68k/kernel: replace strncpy() with strscpy() Mohammad Mahdi Anbaraki
@ 2025-04-22 18:00 ` mohammad mahdi anbaraki
  2025-04-27 23:42 ` Greg Ungerer
  1 sibling, 0 replies; 3+ messages in thread
From: mohammad mahdi anbaraki @ 2025-04-22 18:00 UTC (permalink / raw)
  To: geert; +Cc: linux-m68k, linux-kernel

Hi
.Just a gentle follow-up on this patch
/s/m64k/m68k

‫‪Mohammad Mahdi Anbaraki‬‏ <‪m.mahdianbaraki@gmail.com‬‏> در تاریخ
پنجشنبه ۳ آوریل ۲۰۲۵ ساعت ۲۱:۴۲ نوشت:‬
>
> Swapped out strncpy() for strscpy() in parse_uboot_commandline() while
> copying to commandp. strscpy() makes sure the string is properly null-
> terminated and gives a more useful return value so it's just a safer
> choice overall.
>
> Link: https://github.com/KSPP/linux/issues/90
> Signed-off-by: Mohammad Mahdi Anbaraki <m.mahdianbaraki@gmail.com>
> ---
> Changes in v2:
> - s/m64/m68
>
>  arch/m68k/kernel/uboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
> index 5e52ea150..fa7c279ea 100644
> --- a/arch/m68k/kernel/uboot.c
> +++ b/arch/m68k/kernel/uboot.c
> @@ -73,7 +73,7 @@ static void __init parse_uboot_commandline(char *commandp, int size)
>         uboot_cmd_end = sp[5];
>
>         if (uboot_cmd_start && uboot_cmd_end)
> -               strncpy(commandp, (const char *)uboot_cmd_start, size);
> +               strscpy(commandp, (const char *)uboot_cmd_start, size);
>
>  #if defined(CONFIG_BLK_DEV_INITRD)
>         uboot_initrd_start = sp[2];
> --
> 2.43.0
>

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

* Re: [PATCH v2] m68k/kernel: replace strncpy() with strscpy()
  2025-04-03 18:11 [PATCH v2] m68k/kernel: replace strncpy() with strscpy() Mohammad Mahdi Anbaraki
  2025-04-22 18:00 ` mohammad mahdi anbaraki
@ 2025-04-27 23:42 ` Greg Ungerer
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Ungerer @ 2025-04-27 23:42 UTC (permalink / raw)
  To: Mohammad Mahdi Anbaraki, geert; +Cc: linux-m68k, linux-kernel

Hi Homammad,

On 4/4/25 04:11, Mohammad Mahdi Anbaraki wrote:
> Swapped out strncpy() for strscpy() in parse_uboot_commandline() while
> copying to commandp. strscpy() makes sure the string is properly null-
> terminated and gives a more useful return value so it's just a safer
> choice overall.
> 
> Link: https://github.com/KSPP/linux/issues/90
> Signed-off-by: Mohammad Mahdi Anbaraki <m.mahdianbaraki@gmail.com>

Thanks. Seeing as this only affects nommu/coldfire I will apply this
to the m68knommu git tree, for-next branch.

Regards
Greg


> ---
> Changes in v2:
> - s/m64/m68
> 
>   arch/m68k/kernel/uboot.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
> index 5e52ea150..fa7c279ea 100644
> --- a/arch/m68k/kernel/uboot.c
> +++ b/arch/m68k/kernel/uboot.c
> @@ -73,7 +73,7 @@ static void __init parse_uboot_commandline(char *commandp, int size)
>   	uboot_cmd_end = sp[5];
>   
>   	if (uboot_cmd_start && uboot_cmd_end)
> -		strncpy(commandp, (const char *)uboot_cmd_start, size);
> +		strscpy(commandp, (const char *)uboot_cmd_start, size);
>   
>   #if defined(CONFIG_BLK_DEV_INITRD)
>   	uboot_initrd_start = sp[2];


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

end of thread, other threads:[~2025-04-27 23:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-03 18:11 [PATCH v2] m68k/kernel: replace strncpy() with strscpy() Mohammad Mahdi Anbaraki
2025-04-22 18:00 ` mohammad mahdi anbaraki
2025-04-27 23:42 ` Greg Ungerer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®