From bb18675d0c3c159cb771bb8c54722835ca8faebe Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Thu, 6 Jun 2024 00:38:30 -0400 Subject: [PATCH] LU-17000 utils: Call yaml_parser_scan before using 'token' 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 Change-Id: Ieeb3d50a32690dc892a831fb60a9e85e4ec05113 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55330 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- lustre/utils/lustre_cfg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lustre/utils/lustre_cfg.c b/lustre/utils/lustre_cfg.c index 57c09d9..a0f4e79 100644 --- a/lustre/utils/lustre_cfg.c +++ b/lustre/utils/lustre_cfg.c @@ -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: -- 1.8.3.1