From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751489AbbCUQ6I (ORCPT ); Sat, 21 Mar 2015 12:58:08 -0400 Received: from mail-yk0-f196.google.com ([209.85.160.196]:33698 "EHLO mail-yk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751420AbbCUQ6F (ORCPT ); Sat, 21 Mar 2015 12:58:05 -0400 X-Greylist: delayed 685 seconds by postgrey-1.27 at vger.kernel.org; Sat, 21 Mar 2015 12:58:05 EDT From: Sanidhya Kashyap To: mikulas@artax.karlin.mff.cuni.cz, linux-kernel@vger.kernel.org Cc: taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu, blee@gatech.edu, Sanidhya Kashyap Subject: [PATCH] hpfs: kstrdup() memory handling Date: Sat, 21 Mar 2015 12:57:50 -0400 Message-Id: <1426957070-2914-1-git-send-email-sanidhya.gatech@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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