Skip to contentSkip to conversation

hfs: incorrect return values

PATCH In review Chengyu Song 2 participants 2 messages Mar 25, 2015

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

PATCH 1/1 hfs: incorrect return values

In case of memory allocation error, the return should be -ENOMEM, instead of -ENOSPC.

---
 fs/hfs/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/hfs/dir.c +2 -2
index 1455668..36d1a6a 100644
@@ -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) {
Signature · 1 line
2.1.0
#1 lore raw
Quoted 3 lines · Chengyu Song

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.