sparc64: Fix buggy strlcpy() conversion in ldom_reboot().
authorDavid S. Miller <davem@davemloft.net>
Fri, 27 Sep 2013 20:46:04 +0000 (13:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Oct 2013 01:14:29 +0000 (18:14 -0700)
commitbbe57190784d7a3bc024853da48e0eef5b5c4b2e
tree7d62d9e6a0932c269543ffa185aea310e0112e6d
parent38d7d8fe82963c73447177676d32494140652690
sparc64: Fix buggy strlcpy() conversion in ldom_reboot().

[ Upstream commit 2bd161a605f1f84a5fc8a4fe8410113a94f79355 ]

Commit 117a0c5fc9c2d06045bd217385b2b39ea426b5a6 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/sparc/kernel/ds.c