[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [linux-lvm] lvm2_run: don't return uninitialized for _memlock_inc or _memlock_dec



Jim Meyering <jim meyering net> wrote:
> I noticed a valid warning:
>
>   lvmcmdlib.c:45: warning: 'ret' may be used uninitialized in this function
>
> Sure, it's in nominally "Temporary" code (and code we'd rather
> be rid of), but it's been over 6 months.
> Any objection?

It'll be nice when mailman stops removing my patches.
Here it is again:

>From ea56d9fa21cddf7cf78efaf0a7fd66d4b9251c42 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Sun, 22 Jun 2008 18:31:49 +0200
Subject: [PATCH] lvm2_run: don't return uninitialized for _memlock_inc or _memlock_dec

* tools/lvmcmdlib.c: Initialize "ret".  Also avoid useless string
comparison.
---
 tools/lvmcmdlib.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index 6955ffa..6507acc 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -79,9 +79,10 @@ int lvm2_run(void *handle, const char *cmdline)
 	}

 	/* FIXME Temporary - move to libdevmapper */
+	ret = ECMD_PROCESSED;
 	if (!strcmp(cmdline, "_memlock_inc"))
 		memlock_inc();
-	if (!strcmp(cmdline, "_memlock_dec"))
+	else if (!strcmp(cmdline, "_memlock_dec"))
 		memlock_dec();
 	else
 		ret = lvm_run_command(cmd, argc, argv);
--
1.5.6.7.g67e08b


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]