aboutsummaryrefslogtreecommitdiff
path: root/hdata/slca.c
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2015-03-17 11:18:16 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-03-17 17:06:21 +1100
commit8848bedba0a1cd306653c2365b757a840119aa1f (patch)
treedf53b856a8c12856a6c0a23fb4fd22f74f07679f /hdata/slca.c
parent320316c8fc5f59047390842230b729667aa2f6b8 (diff)
downloadskiboot-8848bedba0a1cd306653c2365b757a840119aa1f.zip
skiboot-8848bedba0a1cd306653c2365b757a840119aa1f.tar.gz
skiboot-8848bedba0a1cd306653c2365b757a840119aa1f.tar.bz2
hdata: Fix location code size
Location codes are no more than 80 characters (including terminating NULL char). Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/slca.c')
-rw-r--r--hdata/slca.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hdata/slca.c b/hdata/slca.c
index 9dd679e..aaa5fc6 100644
--- a/hdata/slca.c
+++ b/hdata/slca.c
@@ -79,13 +79,13 @@ const char *slca_get_loc_code_index(uint16_t slca_index)
void slca_vpd_add_loc_code(struct dt_node *node, uint16_t slca_index)
{
const char *fru_loc_code;
- char loc_code[LOC_CODE_SIZE + 1];
+ char loc_code[LOC_CODE_SIZE];
memset(loc_code, 0, sizeof(loc_code));
fru_loc_code = slca_get_loc_code_index(slca_index);
if (!fru_loc_code)
return;
- strncpy(loc_code, fru_loc_code, LOC_CODE_SIZE);
+ strncpy(loc_code, fru_loc_code, LOC_CODE_SIZE - 1);
dt_add_property(node, "ibm,loc-code", loc_code, strlen(loc_code) + 1);
}