Whamcloud - gitweb
LU-17673 llite: ll_options() to release the string 54/54554/4
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 25 Mar 2024 07:39:51 +0000 (10:39 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Apr 2024 15:38:14 +0000 (15:38 +0000)
the final strsep() sets opts to NULL so kfree() becomes no-op.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I18a0d3556fa2932c217d9e705af9e5b5720a364b
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54554
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/llite_lib.c

index ff0cd9f..c8ee45a 100644 (file)
@@ -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);
 }