Skip to contentSkip to conversation

hfsplus: incorrect return value

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

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

PATCH 1/1 hfsplus: incorrect return value

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

---
 fs/hfsplus/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/hfsplus/dir.c +2 -2
index f0235c1..3074609 100644
@@ -434,7 +434,7 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
 {
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
 	struct inode *inode;
-	int res = -ENOSPC;
+	int res = -ENOMEM;
 
 	mutex_lock(&sbi->vh_mutex);
 	inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO);
@@ -476,7 +476,7 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
 {
 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
 	struct inode *inode;
-	int res = -ENOSPC;
+	int res = -ENOMEM;
 
 	mutex_lock(&sbi->vh_mutex);
 	inode = hfsplus_new_inode(dir->i_sb, mode);
Signature · 1 line
2.1.0
Reviewed-by on v1 1/1
#1 lore raw

CC-ing Andrew Morton.

Quoted 37 lines · Chengyu Song

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

---
 fs/hfsplus/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/hfsplus/dir.c +2 -3
index f0235c1..3074609 100644
@@ -434,7 +434,7 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
 {
        struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
        struct inode *inode;
-       int res = -ENOSPC;
+       int res = -ENOMEM;
 
        mutex_lock(&sbi->vh_mutex);
        inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO);
@@ -476,7 +476,7 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
 {
        struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb);
        struct inode *inode;
-       int res = -ENOSPC;
+       int res = -ENOMEM;
 
        mutex_lock(&sbi->vh_mutex);
        inode = hfsplus_new_inode(dir->i_sb, mode);
--

2.1.0

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

#2 lore raw
In reply to Chengyu Song
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.