diff mbox

[1/1] hfs: incorrect return values

Message ID 1427243843-25929-1-git-send-email-csong84@gatech.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Chengyu Song March 25, 2015, 12:37 a.m. UTC
In case of memory allocation error, the return should be -ENOMEM,
instead of -ENOSPC.

Signed-off-by: Chengyu Song <csong84@gatech.edu>
---
 fs/hfs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Viacheslav Dubeyko March 25, 2015, 4:54 p.m. UTC | #1
On Tue, 2015-03-24 at 20:37 -0400, Chengyu Song wrote:
> In case of memory allocation error, the return should be -ENOMEM,
> instead of -ENOSPC.
> 

To be honest, I am not fully sure that such fix makes sense. Of course,
it is possible to exchange -ENOSPC on -ENOMEM. But principally it is not
critical to use as -ENOSPC as -ENOMEM in such situation, from my point
of view.

Anyway, it is possible to change error code here.

Thanks,
Vyacheslav Dubeyko.


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 1455668..36d1a6a 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -197,7 +197,7 @@  static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 
 	inode = hfs_new_inode(dir, &dentry->d_name, mode);
 	if (!inode)
-		return -ENOSPC;
+		return -ENOMEM;
 
 	res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode);
 	if (res) {
@@ -226,7 +226,7 @@  static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 
 	inode = hfs_new_inode(dir, &dentry->d_name, S_IFDIR | mode);
 	if (!inode)
-		return -ENOSPC;
+		return -ENOMEM;
 
 	res = hfs_cat_create(inode->i_ino, dir, &dentry->d_name, inode);
 	if (res) {