All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ext4: return -ENOMEM instead of success
@ 2016-12-07 11:21 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-12-07 11:21 UTC (permalink / raw
  To: Theodore Ts'o, Tao Ma; +Cc: Andreas Dilger, linux-ext4, kernel-janitors

We should set the error code if kzalloc() fails.

Fixes: 67cf5b09a46f ("ext4: add the basic function for inline data support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 9b67f75bdcf7..437df6a1a841 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -341,8 +341,10 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
 
 	len -= EXT4_MIN_INLINE_DATA_SIZE;
 	value = kzalloc(len, GFP_NOFS);
-	if (!value)
+	if (!value) {
+		error = -ENOMEM;
 		goto out;
+	}
 
 	error = ext4_xattr_ibody_get(inode, i.name_index, i.name,
 				     value, len);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] ext4: return -ENOMEM instead of success
@ 2016-12-07 11:21 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-12-07 11:21 UTC (permalink / raw
  To: Theodore Ts'o, Tao Ma; +Cc: Andreas Dilger, linux-ext4, kernel-janitors

We should set the error code if kzalloc() fails.

Fixes: 67cf5b09a46f ("ext4: add the basic function for inline data support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 9b67f75bdcf7..437df6a1a841 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -341,8 +341,10 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
 
 	len -= EXT4_MIN_INLINE_DATA_SIZE;
 	value = kzalloc(len, GFP_NOFS);
-	if (!value)
+	if (!value) {
+		error = -ENOMEM;
 		goto out;
+	}
 
 	error = ext4_xattr_ibody_get(inode, i.name_index, i.name,
 				     value, len);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] ext4: return -ENOMEM instead of success
  2016-12-07 11:21 ` Dan Carpenter
@ 2016-12-10 14:58   ` Theodore Ts'o
  -1 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2016-12-10 14:58 UTC (permalink / raw
  To: Dan Carpenter; +Cc: Tao Ma, Andreas Dilger, linux-ext4, kernel-janitors

On Wed, Dec 07, 2016 at 02:21:06PM +0300, Dan Carpenter wrote:
> We should set the error code if kzalloc() fails.
> 
> Fixes: 67cf5b09a46f ("ext4: add the basic function for inline data support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] ext4: return -ENOMEM instead of success
@ 2016-12-10 14:58   ` Theodore Ts'o
  0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2016-12-10 14:58 UTC (permalink / raw
  To: Dan Carpenter; +Cc: Tao Ma, Andreas Dilger, linux-ext4, kernel-janitors

On Wed, Dec 07, 2016 at 02:21:06PM +0300, Dan Carpenter wrote:
> We should set the error code if kzalloc() fails.
> 
> Fixes: 67cf5b09a46f ("ext4: add the basic function for inline data support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-10 22:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 11:21 [patch] ext4: return -ENOMEM instead of success Dan Carpenter
2016-12-07 11:21 ` Dan Carpenter
2016-12-10 14:58 ` Theodore Ts'o
2016-12-10 14:58   ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.