Skip to contentSkip to conversation

hpfs: kstrdup() memory handling

PATCH New Sanidhya Kashyap 1 participant 1 message Mar 21, 2015 Hpfs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hpfs: kstrdup() memory handling

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

---
 fs/hpfs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/hpfs/super.c +3 -0
index 7cd00d3..885eadb 100644
@@ -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);
 
Signature · 1 line
2.1.0