Whamcloud - gitweb
LU-17000 utils: Initialize var 'gw' and 'net' before using 16/55316/2
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 5 Jun 2024 06:46:13 +0000 (02:46 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 10 Jun 2024 06:15:26 +0000 (06:15 +0000)
Although this is called at "sequence end" and most
likely 'gw' and 'net' will be populated by then. It
is still good to be defensive and make them initialize

Test-Parameters: trivial testlist=sanity-lnet
CoverityID: 410246 ("Uninitialized scalar variable")
CoverityID: 410240 ("Uninitialized scalar variable")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I2f47df431eea0e0344043ac22806865e87435c6e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55316
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/portals.c

index 37ee203..0f259bc 100644 (file)
@@ -1833,7 +1833,7 @@ jt_ptl_fail_nid(int argc, char **argv)
 
 static int ptl_yaml_route_display(yaml_parser_t *reply)
 {
-       char gw[LNET_MAX_STR_LEN], net[18];
+       char gw[LNET_MAX_STR_LEN] = "", net[18] = "";
        bool done = false, alive = false;
        int hops = -1, prio = -1;
        yaml_event_t event;