diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-02-25 11:51:49 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-03-05 00:56:27 -0500 |
commit | 6b6680c4ea3952af8ae76915cbca41245147741b (patch) | |
tree | 3863f55ebb6a7f1c49830337c7a8aa52443c54a8 /arch/powerpc | |
parent | 27777890d0fae55d14ef18791fc7994faf1bc867 (diff) |
powerpc/pseries/hvcserver: Fix strncpy buffer limit in location code
the dest buf len is 80 (HVCS_CLC_LENGTH + 1).
the src buf len is PAGE_SIZE.
if src buf string len is more than 80, it will cause issue.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/pseries/hvcserver.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c index fcf4b4cbeaf3..4557e91626c4 100644 --- a/arch/powerpc/platforms/pseries/hvcserver.c +++ b/arch/powerpc/platforms/pseries/hvcserver.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/string.h> | ||
26 | 27 | ||
27 | #include <asm/hvcall.h> | 28 | #include <asm/hvcall.h> |
28 | #include <asm/hvcserver.h> | 29 | #include <asm/hvcserver.h> |
@@ -188,9 +189,9 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head, | |||
188 | = (unsigned int)last_p_partition_ID; | 189 | = (unsigned int)last_p_partition_ID; |
189 | 190 | ||
190 | /* copy the Null-term char too */ | 191 | /* copy the Null-term char too */ |
191 | strncpy(&next_partner_info->location_code[0], | 192 | strlcpy(&next_partner_info->location_code[0], |
192 | (char *)&pi_buff[2], | 193 | (char *)&pi_buff[2], |
193 | strlen((char *)&pi_buff[2]) + 1); | 194 | sizeof(next_partner_info->location_code)); |
194 | 195 | ||
195 | list_add_tail(&(next_partner_info->node), head); | 196 | list_add_tail(&(next_partner_info->node), head); |
196 | next_partner_info = NULL; | 197 | next_partner_info = NULL; |