[ibsim patch 05/23] sim_cmd.c: fix ‘orig’ may be used uninitialized

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

 



cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables  -Wall -g -Werror -Wno-deprecated-declarations -fpic -I. -I../include -I/usr/include -c -o sim_cmd.o sim_cmd.c
sim_cmd.c: In function ‘do_cmd’:
sim_cmd.c:911:11: error: ‘orig’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  nodeid = expand_name(orig, name, &sp);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sim_cmd.c:897:19: note: ‘orig’ was declared here
  char *s = line, *orig, *sp, *nodeid, *attr, *field, *field_trim, *end_ptr;

Signed-off-by: Honggang Li <honli@xxxxxxxxxx>
---
 ibsim/sim_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ibsim/sim_cmd.c b/ibsim/sim_cmd.c
index 92343525645b..fa5ff9baea6b 100644
--- a/ibsim/sim_cmd.c
+++ b/ibsim/sim_cmd.c
@@ -894,7 +894,7 @@ static int parse_vl_num(char *attr, char *field, int *vl)
 
 static int do_perf_counter_set(FILE *f, char *line)
 {
-	char *s = line, *orig, *sp, *nodeid, *attr, *field, *field_trim, *end_ptr;
+	char *s = line, *orig = NULL, *sp, *nodeid, *attr, *field, *field_trim, *end_ptr;
 	Node *node;
 	int portnum, vl;
 	uint64_t value;
-- 
2.15.0-rc1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux