Whamcloud - gitweb
LU-17000 utils: Call yaml_parser_scan before using 'token' 30/55330/4
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Thu, 6 Jun 2024 04:38:30 +0000 (00:38 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 19 Jun 2024 01:14:50 +0000 (01:14 +0000)
Function 'yaml_parser_scan' is used to initilize and get
the next token. Call yaml_parser_scan() before using token.

Test-Parameters: trivial testlist=sanity-lnet
CoverityID: 403112 ("Uninitialized scalar variable")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ieeb3d50a32690dc892a831fb60a9e85e4ec05113
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55330
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/lustre_cfg.c

index 57c09d9..a0f4e79 100644 (file)
@@ -1951,10 +1951,9 @@ static int lcfg_apply_param_yaml(char *func, char *filename)
         * when we have all 3, create param=val and call the
         * appropriate function for set/conf param
         */
-       while (token.type != YAML_STREAM_END_TOKEN) {
+       do {
                int i;
 
-               yaml_token_delete(&token);
                if (!yaml_parser_scan(&parser, &token)) {
                        rc = 1;
                        break;
@@ -2055,7 +2054,7 @@ static int lcfg_apply_param_yaml(char *func, char *filename)
                        device[0] = '\0';
                        free(buf);
                }
-       }
+       } while (token.type != YAML_STREAM_END_TOKEN);
 
        yaml_parser_delete(&parser);
 out_init: