In affs_remount if data is provided it is duplicated into new_opts.
The allocated memory for new_opts is only released if pare_options fail.
But the variable is not used anywhere. So the new_opts should be
removed.

Fixes: c8f33d0bec99 ("affs: kstrdup() memory handling")
Signed-off-by: Navid Emamdoost <[email protected]>
---
Changes in v2:
        -- fix typo
Changes in v3:
        -- remove the call to kstrdup, as new_opts is not used anymore.
---
 fs/affs/super.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/fs/affs/super.c b/fs/affs/super.c
index cc463ae47c12..b6c6080d186c 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -565,10 +565,6 @@ affs_remount(struct super_block *sb, int *flags, char 
*data)
        char                     volume[32];
        char                    *prefix = NULL;
 
-       new_opts = kstrdup(data, GFP_KERNEL);
-       if (data && !new_opts)
-               return -ENOMEM;
-
        pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);
 
        sync_filesystem(sb);
@@ -579,7 +575,6 @@ affs_remount(struct super_block *sb, int *flags, char *data)
                           &blocksize, &prefix, volume,
                           &mount_flags)) {
                kfree(prefix);
-               kfree(new_opts);
                return -EINVAL;
        }
 
-- 
2.17.1

Reply via email to