From 111113da022b1c3434e6777eb7f50a2be5d1455f Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Mon, 28 Mar 2011 11:34:48 -0400 Subject: [PATCH] More fixes for uninitialized variable usage Signed-off-by: Doug Ledford --- mdadm-3.1.5-unused-param.patch | 57 +++++++++++++++++++++++++++------- mdadm.spec | 2 +- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/mdadm-3.1.5-unused-param.patch b/mdadm-3.1.5-unused-param.patch index 4f7b27c..b5a99c1 100644 --- a/mdadm-3.1.5-unused-param.patch +++ b/mdadm-3.1.5-unused-param.patch @@ -1,3 +1,17 @@ +--- mdadm-3.2.1/sysfs.c.param 2011-03-28 11:28:13.599402233 -0400 ++++ mdadm-3.2.1/sysfs.c 2011-03-28 11:29:29.427842126 -0400 +@@ -428,6 +428,11 @@ int sysfs_uevent(struct mdinfo *sra, cha + return -1; + n = write(fd, event, strlen(event)); + close(fd); ++ if (n != strlen(event)) { ++ dprintf(Name ": failed to write '%s' to '%s' (%s)\n", ++ event, fname, strerror(errno)); ++ return -1; ++ } + return 0; + } + --- mdadm-3.2.1/mdadm.c.param 2011-03-28 10:38:12.035258787 -0400 +++ mdadm-3.2.1/mdadm.c 2011-03-28 10:39:33.346082070 -0400 @@ -103,7 +103,9 @@ int main(int argc, char *argv[]) @@ -24,6 +38,18 @@ } while (rv2!=2); /* Incase there are stacked devices, we need to go around again */ } while (acnt); +--- mdadm-3.2.1/mdmon.c.param 2011-03-28 11:29:41.128681560 -0400 ++++ mdadm-3.2.1/mdmon.c 2011-03-28 11:30:54.514946394 -0400 +@@ -513,6 +513,9 @@ static int mdmon(char *devname, int devn + ignore = dup(0); + #endif + ++ if (ignore) ++ ignore++; ++ + do_manager(container); + + exit(0); --- mdadm-3.2.1/Grow.c.param 2011-03-28 10:38:12.038259001 -0400 +++ mdadm-3.2.1/Grow.c 2011-03-28 10:45:28.174500010 -0400 @@ -1312,7 +1312,6 @@ int Grow_reshape(char *devname, int fd, @@ -98,18 +124,18 @@ if (cnt > 1) printf("?"); else if (cnt == 1) printf("A"); --- mdadm-3.2.1/Incremental.c.param 2011-03-28 10:38:12.045259502 -0400 -+++ mdadm-3.2.1/Incremental.c 2011-03-28 11:02:05.731982753 -0400 -@@ -735,7 +735,7 @@ static int count_active(struct supertype - continue; - info.array.raid_disks = raid_disks; - st->ss->getinfo_super(st, &info, devmap + raid_disks * devnum); -- if (!avail) { -+ if (!avail || !best) { - raid_disks = info.array.raid_disks; - avail = calloc(raid_disks, 1); - if (!avail) { ++++ mdadm-3.2.1/Incremental.c 2011-03-28 11:31:41.924347665 -0400 +@@ -707,7 +707,7 @@ static int count_active(struct supertype + int cnt = 0; + __u64 max_events = 0; + char *avail = NULL; +- int *best; ++ int *best = NULL; + char *devmap = NULL; + int numdevs = 0; + int devnum; --- mdadm-3.2.1/super-intel.c.param 2011-03-28 10:38:12.048259718 -0400 -+++ mdadm-3.2.1/super-intel.c 2011-03-28 11:20:01.651114866 -0400 ++++ mdadm-3.2.1/super-intel.c 2011-03-28 11:33:53.898816208 -0400 @@ -6164,7 +6164,7 @@ static int apply_takeover_update(struct { struct imsm_dev *dev = NULL; @@ -119,3 +145,12 @@ struct imsm_map *map; struct dl *dm, *du; int i; +@@ -7008,7 +7008,7 @@ static int imsm_create_metadata_update_f + int update_memory_size = 0; + struct imsm_update_reshape *u = NULL; + struct mdinfo *spares = NULL; +- int i; ++ int i = -1; + int delta_disks = 0; + struct mdinfo *dev; + diff --git a/mdadm.spec b/mdadm.spec index 24a5c84..6ceffa1 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -1,7 +1,7 @@ Summary: The mdadm program controls Linux md devices (software RAID arrays) Name: mdadm Version: 3.2.1 -Release: 0%{?dist}.1 +Release: 1%{?dist} Source: http://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-%{version}.tar.bz2 Source1: mdmonitor.init Source2: raid-check