[PATCH] bs_sheepdog.c: fix gcc warning at sd_open()

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

 



This fixes the following warning at sd_open function, which happens
because gcc isn't always perfect with determining whether a variable
is used uninitialized:

cc -c -DUSE_SIGNALFD -DUSE_TIMERFD -D_GNU_SOURCE -I. -g -O2
-fno-strict-aliasing -Wall -Wstrict-prototypes -fPIC DTGT_VERSION=\"\"
--DBSDIR=\"/lib/tgt/backing-store\" bs_sheepdog.c o bs_sheepdog.o
bs_sheepdog.c: In function 'sd_open':
bs_sheepdog.c:920: warning: 'saveptr' may be used uninitialized in
this function

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx>
---
 usr/bs_sheepdog.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
index d3572db..9848e9f 100644
--- a/usr/bs_sheepdog.c
+++ b/usr/bs_sheepdog.c
@@ -917,7 +917,7 @@ static int sd_open(struct sheepdog_access_info *ai, char *filename, int flags)
 	uint32_t snapid = -1;
 	char tag[SD_MAX_VDI_TAG_LEN + 1];
 	char vdi_name[SD_MAX_VDI_LEN + 1];
-	char *saveptr, *result;
+	char *saveptr = NULL, *result;
 	enum {
 		EXPECT_PROTO,
 		EXPECT_PATH,
-- 
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux