]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Forced type conversion to avoid truncation
authorXiao Ni <xni@redhat.com>
Sat, 18 Mar 2017 02:33:45 +0000 (10:33 +0800)
committerJes Sorensen <Jes.Sorensen@gmail.com>
Tue, 28 Mar 2017 17:56:43 +0000 (13:56 -0400)
Gcc reports it needs 19 bytes to right to disk->serial. Because the
type of argument i is int. But the meaning of i is failed disk
number. So it doesn't need to use 19 bytes.  Just add a type
conversion to avoid this building error

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
super-intel.c

index 343f20d50215996890fb84032eb870d4cfbd6a16..e1618f1c6c1b65778e389c281fbddf8acce45aff 100644 (file)
@@ -5228,7 +5228,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
                        disk->status = CONFIGURED_DISK | FAILED_DISK;
                        disk->scsi_id = __cpu_to_le32(~(__u32)0);
                        snprintf((char *) disk->serial, MAX_RAID_SERIAL_LEN,
-                                "missing:%d", i);
+                                "missing:%d", (__u8)i);
                }
                find_missing(super);
        } else {