[PATCH] hpfs: kstrdup() memory handling

From: Sanidhya Kashyap
Date: Sat Mar 21 2015 - 12:58:11 EST


There is a possibility of nothing being allocated to the new_opts in
case of memory pressure, therefore return ENOMEM for such case.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@xxxxxxxxx>
---
fs/hpfs/super.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 7cd00d3..885eadb 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -424,6 +424,9 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
int o;
struct hpfs_sb_info *sbi = hpfs_sb(s);
char *new_opts = kstrdup(data, GFP_KERNEL);
+
+ if (!new_opts)
+ return -ENOMEM;

sync_filesystem(s);

--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/