diff options
author | Stewart Smith <stewart@linux.ibm.com> | 2019-06-18 16:06:44 +1000 |
---|---|---|
committer | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2019-08-06 15:01:43 +0530 |
commit | bf35b9d9c417946ec4d212dfebf737097a204933 (patch) | |
tree | 248230fe16a7e798dcecabd576aa528f49a7c70a /hdata | |
parent | e92d8dc9dd326fbe189c64b25fab8c8aa2cae3e0 (diff) | |
download | skiboot-bf35b9d9c417946ec4d212dfebf737097a204933.zip skiboot-bf35b9d9c417946ec4d212dfebf737097a204933.tar.gz skiboot-bf35b9d9c417946ec4d212dfebf737097a204933.tar.bz2 |
hdata/vpd: fix printing (char*)0x00
[ Upstream commit ba977f2e4406f9de318afcdf5d666e77585ef269 ]
GCC9 now catches this bug:
In file included from hdata/vpd.c:17:
In function ‘vpd_vini_parse’,
inlined from ‘vpd_data_parse’ at hdata/vpd.c:416:3:
/home/stewart/skiboot/include/skiboot.h:93:31: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
93 | #define prlog(l, f, ...) do { _prlog(l, pr_fmt(f), ##__VA_ARGS__); } while(0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hdata/vpd.c:390:5: note: in expansion of macro ‘prlog’
390 | prlog(PR_WARNING,
| ^~~~~
hdata/vpd.c: In function ‘vpd_data_parse’:
hdata/vpd.c:391:46: note: format string is defined here
391 | "VPD: CCIN desc not available for: %s\n",
| ^~
cc1: all warnings being treated as errors
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r-- | hdata/vpd.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/hdata/vpd.c b/hdata/vpd.c index 129b506..5a01bcc 100644 --- a/hdata/vpd.c +++ b/hdata/vpd.c @@ -328,6 +328,7 @@ static void vpd_vini_parse(struct dt_node *node, const void *fruvpd, unsigned int fruvpd_sz) { const void *kw; + const char *desc; uint8_t sz; const struct card_info *cinfo; @@ -381,15 +382,15 @@ static void vpd_vini_parse(struct dt_node *node, dt_add_property_string(node, "description", cinfo->description); } else { - kw = vpd_find(fruvpd, fruvpd_sz, "VINI", "DR", &sz); - if (kw) { + desc = vpd_find(fruvpd, fruvpd_sz, "VINI", "DR", &sz); + if (desc) { dt_add_prop_sanitize_val(node, - "description", kw, sz); + "description", desc, sz); } else { dt_add_property_string(node, "description", "Unknown"); prlog(PR_WARNING, "VPD: CCIN desc not available for: %s\n", - (char *)kw); + (char*)kw); } } } |