Skip to content

Commit

Permalink
sparc64: Fix buggy strlcpy() conversion in ldom_reboot().
Browse files Browse the repository at this point in the history
Commit 117a0c5 ("sparc: kernel: using
strlcpy() instead of strcpy()") added a bug to ldom_reboot in
arch/sparc/kernel/ds.c

-		strcpy(full_boot_str + strlen("boot "), boot_command);
+				     strlcpy(full_boot_str + strlen("boot "), boot_command,
+				     			     sizeof(full_boot_str + strlen("boot ")));

That last sizeof() expression evaluates to sizeof(size_t) which is
not what was intended.

Also even the corrected:

     sizeof(full_boot_str) + strlen("boot ")

is not right as the destination buffer length is just plain
"sizeof(full_boot_str)" and that's what the final argument
should be.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 27, 2013
1 parent 6cac446 commit 2bd161a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sparc/kernel/ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ void ldom_reboot(const char *boot_command)

strcpy(full_boot_str, "boot ");
strlcpy(full_boot_str + strlen("boot "), boot_command,
sizeof(full_boot_str + strlen("boot ")));
sizeof(full_boot_str));
len = strlen(full_boot_str);

if (reboot_data_supported) {
Expand Down

0 comments on commit 2bd161a

Please sign in to comment.