From: Arshad Hussain Date: Wed, 5 Jun 2024 06:46:13 +0000 (-0400) Subject: LU-17000 utils: Initialize var 'gw' and 'net' before using X-Git-Tag: 2.15.64~81 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3b888d00da1a92b7c872c5de1fab8e8a3d6363b8;p=fs%2Flustre-release.git LU-17000 utils: Initialize var 'gw' and 'net' before using 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 Change-Id: I2f47df431eea0e0344043ac22806865e87435c6e Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55316 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/portals.c b/lustre/utils/portals.c index 37ee203..0f259bc 100644 --- a/lustre/utils/portals.c +++ b/lustre/utils/portals.c @@ -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;