Skip to contentSkip to conversation

quota_v2: Delete an error message for a failed memory allocation in v2_read_file_info()

PATCH In review SF Markus Elfring 2 participants 2 messages Aug 16, 2017 – Aug 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota_v2: Delete an error message for a failed memory allocation in v2_read_file_info()

From: Markus Elfring <[email protected]>
Date: Wed, 16 Aug 2017 16:16:30 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 fs/quota/quota_v2.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/quota/quota_v2.c +2 -4
index ca71bf881ad1..2259329616b7 100644
@@ -109,11 +109,9 @@ static int v2_read_file_info(struct super_block *sb, int type)
 		return -1;
 	}
 	info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
-	if (!info->dqi_priv) {
-		printk(KERN_WARNING
-		       "Not enough memory for quota information structure.\n");
+	if (!info->dqi_priv)
 		return -ENOMEM;
-	}
+
 	qinfo = info->dqi_priv;
 	if (version = 0) {
 		/* limits are stored as unsigned 32-bit data */
Signature · 1 line
2.14.0
#1 lore raw
Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 16 Aug 2017 16:16:30 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

OK, applied the patch to my tree. Thanks.

Honza

Quoted 26 lines
---
 fs/quota/quota_v2.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/quota/quota_v2.c +2 -4
index ca71bf881ad1..2259329616b7 100644
@@ -109,11 +109,9 @@ static int v2_read_file_info(struct super_block *sb, int type)
 		return -1;
 	}
 	info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
-	if (!info->dqi_priv) {
-		printk(KERN_WARNING
-		       "Not enough memory for quota information structure.\n");
+	if (!info->dqi_priv)
 		return -ENOMEM;
-	}
+
 	qinfo = info->dqi_priv;
 	if (version = 0) {
 		/* limits are stored as unsigned 32-bit data */
Signature · 1 line
2.14.0
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR