All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] multipath-tools: fix minor compilation issues
@ 2006-03-13 12:27 Hannes Reinecke
  2006-03-13 13:50 ` Christophe Varoqui
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2006-03-13 12:27 UTC (permalink / raw)
  To: device-mapper development

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Hi Christophe,

our checker found some minor issues:

- refwwid in libmultipath/configure.c:get_refwwid() might be used
  uninitialized. As dev_type is a simple 'int' there is nothing which
  prevents the unsuspecting user to call it with an unhandled value.
  We shoud rather use an enum and set refwwid to NULL to be on the safe
  side.
- attr in libmultipath/discovery.c:devt2devname() might be used
  uninitialized. Quite unlikely, but might happen in principle.
  So better have it initialized.
- r in multipath/main.c:main() might be used uninitialized.
  True. So have it initialized.

Please apply.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke			hare@suse.de
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

[-- Attachment #2: multipath-tools-compile-fixes.patch --]
[-- Type: text/x-patch, Size: 2485 bytes --]

diff --git a/libmultipath/config.h b/libmultipath/config.h
index 6e5633a..43282fe 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -48,7 +48,7 @@ struct config {
 	int with_sysfs;
 	int pgpolicy;
 	struct checker * checker;
-	int dev_type;
+	enum devtypes dev_type;
 	int minio;
 	int checkint;
 	int max_checkint;
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 1ba4356..7285617 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -547,11 +547,11 @@ coalesce_paths (struct vectors * vecs, v
 }
 
 extern char *
-get_refwwid (char * dev, int dev_type, vector pathvec)
+get_refwwid (char * dev, enum devtypes dev_type, vector pathvec)
 {
 	struct path * pp;
 	char buff[FILE_NAME_SIZE];
-	char * refwwid;
+	char * refwwid = NULL;
 
 	if (dev_type == DEV_NONE)
 		return NULL;
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 42ee9b0..1cbbe82 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -25,5 +25,5 @@ int setup_map (struct multipath * mpp);
 int domap (struct multipath * mpp);
 int reinstate_paths (struct multipath *mpp);
 int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid);
-char * get_refwwid (char * dev, int dev_type, vector pathvec);
+char * get_refwwid (char * dev, enum devtypes dev_type, vector pathvec);
 
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index cf8289c..0b8095c 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -237,7 +237,7 @@ devt2devname (char *devname, char *devt)
 	struct dlist * ls;
 	char attr_path[FILE_NAME_SIZE];
 	char block_path[FILE_NAME_SIZE];
-	struct sysfs_attribute * attr;
+	struct sysfs_attribute * attr = NULL;
 	struct sysfs_class * class;
 	struct sysfs_class_device * dev;
 
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 6cc63e2..2c44122 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -13,8 +13,8 @@
 #include "structs_vec.h"
 #include "print.h"
 #include "dmparser.h"
-#include "configure.h"
 #include "config.h"
+#include "configure.h"
 #include "pgpolicies.h"
 #include "defaults.h"
 #include "parser.h"
diff --git a/multipath/main.c b/multipath/main.c
index 98f7207..931b137 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -305,7 +305,7 @@ main (int argc, char *argv[])
 	int arg;
 	extern char *optarg;
 	extern int optind;
-	int i, r;
+	int i, r = 1;
 
 	if (getuid() != 0) {
 		fprintf(stderr, "need to be root\n");

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] multipath-tools: fix minor compilation issues
  2006-03-13 12:27 [PATCH] multipath-tools: fix minor compilation issues Hannes Reinecke
@ 2006-03-13 13:50 ` Christophe Varoqui
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Varoqui @ 2006-03-13 13:50 UTC (permalink / raw)
  To: device-mapper development

On Mon, Mar 13, 2006 at 01:27:40PM +0100, Hannes Reinecke wrote:
> Hi Christophe,
> 
> our checker found some minor issues:
> 
> - refwwid in libmultipath/configure.c:get_refwwid() might be used
>   uninitialized. As dev_type is a simple 'int' there is nothing which
>   prevents the unsuspecting user to call it with an unhandled value.
>   We shoud rather use an enum and set refwwid to NULL to be on the safe
>   side.
> - attr in libmultipath/discovery.c:devt2devname() might be used
>   uninitialized. Quite unlikely, but might happen in principle.
>   So better have it initialized.
> - r in multipath/main.c:main() might be used uninitialized.
>   True. So have it initialized.
> 
> Please apply.
> 
Applied, thanks.

Regards,
cvaroqui

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-13 13:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-13 12:27 [PATCH] multipath-tools: fix minor compilation issues Hannes Reinecke
2006-03-13 13:50 ` Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.