]> git.ipfire.org Git - people/pmueller/ipfire-3.x.git/blame - multipath-tools/patches/0097-RH-fix-coverity-errors.patch
multipath-tools: Update to snapshot from 2013-02-22
[people/pmueller/ipfire-3.x.git] / multipath-tools / patches / 0097-RH-fix-coverity-errors.patch
CommitLineData
289c5516
MT
1---
2 kpartx/devmapper.c | 3 ++-
3 libmultipath/alias.c | 1 +
4 libmultipath/blacklist.c | 7 +++++++
5 libmultipath/prioritizers/iet.c | 2 ++
6 libmultipath/prioritizers/weightedpath.c | 5 ++++-
7 libmultipath/regex.c | 5 ++++-
8 libmultipath/sysfs.c | 3 ++-
9 libmultipath/util.c | 2 +-
10 8 files changed, 23 insertions(+), 5 deletions(-)
11
12Index: multipath-tools-130222/kpartx/devmapper.c
13===================================================================
14--- multipath-tools-130222.orig/kpartx/devmapper.c
15+++ multipath-tools-130222/kpartx/devmapper.c
16@@ -132,8 +132,9 @@ dm_addmap (int task, const char *name, c
17 goto addout;
18 r = dm_task_run (dmt);
19
20- addout:
21+addout:
22 dm_task_destroy (dmt);
23+ free(prefixed_uuid);
24
25 return r;
26 }
27Index: multipath-tools-130222/libmultipath/alias.c
28===================================================================
29--- multipath-tools-130222.orig/libmultipath/alias.c
30+++ multipath-tools-130222/libmultipath/alias.c
31@@ -328,6 +328,7 @@ get_user_friendly_alias(char *wwid, char
32 if (fflush(f) != 0) {
33 condlog(0, "cannot fflush bindings file stream : %s",
34 strerror(errno));
35+ free(alias);
36 fclose(f);
37 return NULL;
38 }
39Index: multipath-tools-130222/libmultipath/blacklist.c
40===================================================================
41--- multipath-tools-130222.orig/libmultipath/blacklist.c
42+++ multipath-tools-130222/libmultipath/blacklist.c
43@@ -79,6 +79,8 @@ set_ble_device (vector blist, char * ven
44 if (regcomp(&ble->vendor_reg, vendor,
45 REG_EXTENDED|REG_NOSUB)) {
46 FREE(vendor);
47+ if (product)
48+ FREE(product);
49 return 1;
50 }
51 ble->vendor = vendor;
52@@ -87,6 +89,10 @@ set_ble_device (vector blist, char * ven
53 if (regcomp(&ble->product_reg, product,
54 REG_EXTENDED|REG_NOSUB)) {
55 FREE(product);
56+ if (vendor) {
57+ ble->vendor = NULL;
58+ FREE(vendor);
59+ }
60 return 1;
61 }
62 ble->product = product;
63@@ -189,6 +195,7 @@ setup_default_blist (struct config * con
64 STRDUP(hwe->bl_product),
65 ORIGIN_DEFAULT)) {
66 FREE(ble);
67+ vector_del_slot(conf->blist_device, VECTOR_SIZE(conf->blist_device) - 1);
68 return 1;
69 }
70 }
71Index: multipath-tools-130222/libmultipath/prioritizers/iet.c
72===================================================================
73--- multipath-tools-130222.orig/libmultipath/prioritizers/iet.c
74+++ multipath-tools-130222/libmultipath/prioritizers/iet.c
75@@ -109,6 +109,7 @@ int iet_prio(const char *dev, char * arg
76 ssize_t nchars = readlink(path, buffer, sizeof(buffer)-1);
77 if (nchars != -1) {
78 char *device;
79+ buffer[nchars] = '\0';
80 device = find_regex(buffer,"(sd[a-z]+)");
81 // if device parsed is the right one
82 if (device!=NULL && strncmp(device, dev, strlen(device)) == 0) {
83@@ -118,6 +119,7 @@ int iet_prio(const char *dev, char * arg
84 if (ip!=NULL && strncmp(ip, preferredip, strlen(ip)) == 0) {
85 // high prio
86 free(ip);
87+ free(device);
88 closedir(dir_p);
89 return 20;
90 }
91Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
92===================================================================
93--- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.c
94+++ multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
95@@ -61,8 +61,10 @@ int prio_path_weight(struct path *pp, ch
96 regex = get_next_string(&temp, split_char);
97
98 /* Return default priority if the argument is not parseable */
99- if (!regex)
100+ if (!regex) {
101+ FREE(arg);
102 return priority;
103+ }
104
105 if (!strcmp(regex, HBTL)) {
106 sprintf(path, "%d:%d:%d:%d", pp->sg_id.host_no,
107@@ -72,6 +74,7 @@ int prio_path_weight(struct path *pp, ch
108 } else {
109 condlog(0, "%s: %s - Invalid arguments", pp->dev,
110 pp->prio.name);
111+ FREE(arg);
112 return priority;
113 }
114
115Index: multipath-tools-130222/libmultipath/regex.c
116===================================================================
117--- multipath-tools-130222.orig/libmultipath/regex.c
118+++ multipath-tools-130222/libmultipath/regex.c
119@@ -3936,8 +3936,11 @@ int eflags;
120 regs.num_regs = nmatch;
121 regs.start = TALLOC(nmatch, regoff_t);
122 regs.end = TALLOC(nmatch, regoff_t);
123- if (regs.start == NULL || regs.end == NULL)
124+ if (regs.start == NULL || regs.end == NULL) {
125+ free(regs.start);
126+ free(regs.end);
127 return (int) REG_NOMATCH;
128+ }
129 }
130
131 /* Perform the searching operation. */
132Index: multipath-tools-130222/libmultipath/sysfs.c
133===================================================================
134--- multipath-tools-130222.orig/libmultipath/sysfs.c
135+++ multipath-tools-130222/libmultipath/sysfs.c
136@@ -88,7 +88,8 @@ ssize_t sysfs_attr_get_value(struct udev
137 } else if (size == value_len) {
138 condlog(4, "overflow while reading from %s", devpath);
139 size = 0;
140- }
141+ } else
142+ value[size] = '\0';
143
144 close(fd);
145 return size;
146Index: multipath-tools-130222/libmultipath/util.c
147===================================================================
148--- multipath-tools-130222.orig/libmultipath/util.c
149+++ multipath-tools-130222/libmultipath/util.c
150@@ -175,7 +175,7 @@ devt2devname (char *devname, int devname
151 sprintf(block_path,"/sys/dev/block/%u:%u", major, minor);
152 if (lstat(block_path, &statbuf) == 0) {
153 if (S_ISLNK(statbuf.st_mode) &&
154- readlink(block_path, dev, FILE_NAME_SIZE) > 0) {
155+ readlink(block_path, dev, FILE_NAME_SIZE-1) > 0) {
156 char *p = strrchr(dev, '/');
157
158 if (!p) {