summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJes Sorensen <jsorensen@fb.com>2018-05-30 11:56:37 -0400
committerJes Sorensen <jsorensen@fb.com>2018-05-30 11:56:37 -0400
commit40659392ff90fc9c2861ec18c34ed1bdb54f92ca (patch)
treeb657fb1a19297bdfd66b8cb4d8c5817474a6a78a
parent1cdc06dfda62775647b81e2753fc7908e1bbffc2 (diff)
downloadmdadm-40659392ff90fc9c2861ec18c34ed1bdb54f92ca.tar.gz
super-intel: Avoid gcc-8.1 complaining about truncating snprintf()
We know the max size of the volume name, so no need to play the snprintf() game. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
-rw-r--r--super-intel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c
index cc53f0f..520d292 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -9881,6 +9881,7 @@ static void imsm_process_update(struct supertype *st,
/* sanity check that we are not affecting the uuid of
* an active array
*/
+ memset(name, 0, sizeof(name));
snprintf(name, MAX_RAID_SERIAL_LEN, "%s", (char *) u->name);
name[MAX_RAID_SERIAL_LEN] = '\0';
for (a = st->arrays; a; a = a->next)
@@ -9892,7 +9893,7 @@ static void imsm_process_update(struct supertype *st,
break;
}
- snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name);
+ memcpy(dev->volume, name, MAX_RAID_SERIAL_LEN);
super->updates_pending++;
break;
}