arm64/machdep.c: strncpy+overlap - "boot> boot -s" behaviour

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

arm64/machdep.c: strncpy+overlap - "boot> boot -s" behaviour

Artturi Alm
Hi,

another user mentioned on irc about issue w/"boot -s" not working on rpi3.
diff below fixes secondary the strncpy() w/dst==src, and also adds blank
line after the function which does the correct strncpy.

-Artturi


diff --git sys/arch/arm64/arm64/machdep.c sys/arch/arm64/arm64/machdep.c
index ac3a9f6344b..db4bd8532eb 100644
--- sys/arch/arm64/arm64/machdep.c
+++ sys/arch/arm64/arm64/machdep.c
@@ -1121,6 +1121,7 @@ collect_kernel_args(char *args)
  /* Make a local copy of the bootargs */
  strncpy(bootargs, args, MAX_BOOT_STRING - sizeof(int));
 }
+
 void
 process_kernel_args(void)
 {
@@ -1132,11 +1133,6 @@ process_kernel_args(void)
  }
 
  boothowto = 0;
-
- /* Make a local copy of the bootargs */
- strncpy(bootargs, cp, MAX_BOOT_STRING - sizeof(int));
-
- cp = bootargs;
  boot_file = bootargs;
 
  /* Skip the kernel image filename */

Reply | Threaded
Open this post in threaded view
|

Re: arm64/machdep.c: strncpy+overlap - "boot> boot -s" behaviour

Artturi Alm
On Thu, Mar 08, 2018 at 08:42:09AM +0200, Artturi Alm wrote:
> Hi,
>
> another user mentioned on irc about issue w/"boot -s" not working on rpi3.
> diff below fixes secondary the strncpy() w/dst==src, and also adds blank
> line after the function which does the correct strncpy.
>

i just tested it myself, and i had no issues with "boot bsd -cs" on arm64
before applying the diff below going through both UKC&single-user,
but i still think the diff below should be there,
even if just for the correctness.

-Artturi

> -Artturi
>
>
> diff --git sys/arch/arm64/arm64/machdep.c sys/arch/arm64/arm64/machdep.c
> index ac3a9f6344b..db4bd8532eb 100644
> --- sys/arch/arm64/arm64/machdep.c
> +++ sys/arch/arm64/arm64/machdep.c
> @@ -1121,6 +1121,7 @@ collect_kernel_args(char *args)
>   /* Make a local copy of the bootargs */
>   strncpy(bootargs, args, MAX_BOOT_STRING - sizeof(int));
>  }
> +
>  void
>  process_kernel_args(void)
>  {
> @@ -1132,11 +1133,6 @@ process_kernel_args(void)
>   }
>  
>   boothowto = 0;
> -
> - /* Make a local copy of the bootargs */
> - strncpy(bootargs, cp, MAX_BOOT_STRING - sizeof(int));
> -
> - cp = bootargs;
>   boot_file = bootargs;
>  
>   /* Skip the kernel image filename */