Skip to content

Commit

Permalink
affs: kstrdup() memory handling
Browse files Browse the repository at this point in the history
There is a possibility of kstrdup() failure upon memory pressure.
Therefore, returning ENOMEM even for new_opts.

[akpm@linux-foundation.org: cleanup]
Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Cc: Taesoo kim <taesoo@gatech.edu>
Cc: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Sanidhya Kashyap authored and Linus Torvalds committed Apr 17, 2015
1 parent 79bda4d commit c8f33d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/affs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,14 @@ affs_remount(struct super_block *sb, int *flags, char *data)
int root_block;
unsigned long mount_flags;
int res = 0;
char *new_opts = kstrdup(data, GFP_KERNEL);
char *new_opts;
char volume[32];
char *prefix = NULL;

new_opts = kstrdup(data, GFP_KERNEL);
if (!new_opts)
return -ENOMEM;

pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data);

sync_filesystem(sb);
Expand Down

0 comments on commit c8f33d0

Please sign in to comment.