From: Alex Zhuravlev Date: Mon, 25 Mar 2024 07:39:51 +0000 (+0300) Subject: LU-17673 llite: ll_options() to release the string X-Git-Tag: 2.15.62~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=552a813a22e92e2964fc9cc3c47b768185d54bdc;p=fs%2Flustre-release.git LU-17673 llite: ll_options() to release the string the final strsep() sets opts to NULL so kfree() becomes no-op. Signed-off-by: Alex Zhuravlev Change-Id: I18a0d3556fa2932c217d9e705af9e5b5720a364b Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54554 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index ff0cd9f..c8ee45a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1071,7 +1071,7 @@ int ll_sbi_flags_seq_show(struct seq_file *m, void *v) static int ll_options(char *options, struct super_block *sb) { struct ll_sb_info *sbi = ll_s2sbi(sb); - char *s2, *s1, *opts; + char *s2, *s1, *opts, *orig_opts; int err = 0; ENTRY; @@ -1079,7 +1079,7 @@ static int ll_options(char *options, struct super_block *sb) RETURN(0); /* Don't stomp on lmd_opts */ - opts = kstrdup(options, GFP_KERNEL); + orig_opts = opts = kstrdup(options, GFP_KERNEL); if (!opts) RETURN(-ENOMEM); s1 = opts; @@ -1244,7 +1244,7 @@ static int ll_options(char *options, struct super_block *sb) break; } } - kfree(opts); + kfree(orig_opts); RETURN(err); }