aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.ibm.com>2018-05-29 14:26:12 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-05-29 14:57:14 +1000
commit44d0f8638bc1d35baccd59a154298fef0fb51775 (patch)
tree586905af854d4e541baaf4866821dfc76f3ca480 /hdata
parentb32ddeb7ea0de77864e463260c6bb1543e39fe78 (diff)
downloadskiboot-44d0f8638bc1d35baccd59a154298fef0fb51775.zip
skiboot-44d0f8638bc1d35baccd59a154298fef0fb51775.tar.gz
skiboot-44d0f8638bc1d35baccd59a154298fef0fb51775.tar.bz2
hdata/spira.c: fix iplparams feature name string handling
Fixes this gcc8 warning: hdata/test/../spira.c: In function ‘add_iplparams_features’: hdata/test/../spira.c:1209:38: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess] strncpy(name, feature->name, sizeof(feature->name)); ^ Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/spira.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hdata/spira.c b/hdata/spira.c
index 20879ee..b389467 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1206,7 +1206,9 @@ static void add_iplparams_features(const struct HDIF_common_hdr *iplp)
uint64_t flags;
/* the name field isn't necessarily null terminated */
- strncpy(name, feature->name, sizeof(feature->name));
+ BUILD_ASSERT(sizeof(name) > sizeof(feature->name));
+ strncpy(name, feature->name, sizeof(name)-1);
+ name[sizeof(name)-1] = '\0';
flags = be64_to_cpu(feature->flags);
prlog(PR_DEBUG, "IPLPARAMS: FW feature %s = %016"PRIx64"\n",