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-10-24 19:02:59 +1100
commitdd8b717f30a453f6c2c2ac7464dcaa21ebed0bb6 (patch)
tree173a69edca79676224af55e438b4803b01fd4fc5 /hdata
parent6433d05f9b5cd84182b25d1f9917537af090e479 (diff)
downloadskiboot-dd8b717f30a453f6c2c2ac7464dcaa21ebed0bb6.zip
skiboot-dd8b717f30a453f6c2c2ac7464dcaa21ebed0bb6.tar.gz
skiboot-dd8b717f30a453f6c2c2ac7464dcaa21ebed0bb6.tar.bz2
hdata/spira.c: fix iplparams feature name string handling
[ Upstream commit 44d0f8638bc1d35baccd59a154298fef0fb51775 ] 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> 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 fde316e..4945580 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -1208,7 +1208,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",