diff options
author | Jes Sorensen <jsorensen@fb.com> | 2018-05-29 22:09:47 +0200 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2018-05-29 22:09:47 +0200 |
commit | 167d8bb8302170676f0e15123738e333383fec7b (patch) | |
tree | 969445ff207b8e30eacd03ac3106cad18a4fdea5 | |
parent | Do not confuse gcc (diff) | |
download | mdadm-167d8bb8302170676f0e15123738e333383fec7b.tar.xz mdadm-167d8bb8302170676f0e15123738e333383fec7b.zip |
super-intel: Use memcpy() to avoid confusing gcc
When added :0 to serial number and copying it back, use memcpy()
instead of strncpy() as we know the actual length. This stops gcc
from complaining with -Werror=stringop-truncation enabled
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r-- | super-intel.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c index 449da1dd..ec7683d9 100644 --- a/super-intel.c +++ b/super-intel.c @@ -8098,7 +8098,7 @@ static int mark_failure(struct intel_super *super, strcat(buf, ":0"); if ((len = strlen(buf)) >= MAX_RAID_SERIAL_LEN) shift = len - MAX_RAID_SERIAL_LEN + 1; - strncpy((char *)disk->serial, &buf[shift], MAX_RAID_SERIAL_LEN); + memcpy(disk->serial, &buf[shift], len + 1 - shift); disk->status |= FAILED_DISK; set_imsm_ord_tbl_ent(map, slot, idx | IMSM_ORD_REBUILD); |