diff mbox

[1/1] hfsplus: incorrect return value

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

Commit Message

Chengyu Song March 25, 2015, 12:44 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/hfsplus/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sergei Antonov March 25, 2015, 3:34 p.m. UTC | #1
Reviewed-by: Sergei Antonov <saproj@gmail.com>

CC-ing Andrew Morton.

On 25 March 2015 at 01:44, Chengyu Song <csong84@gatech.edu> wrote:
> In case of memory allocation error, the return should be -ENOMEM,
> instead of -ENOSPC.
>
> Signed-off-by: Chengyu Song <csong84@gatech.edu>
> ---
>  fs/hfsplus/dir.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
> index f0235c1..3074609 100644
> --- a/fs/hfsplus/dir.c
> +++ b/fs/hfsplus/dir.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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
Viacheslav Dubeyko March 25, 2015, 4:54 p.m. UTC | #2
On Tue, 2015-03-24 at 20:44 -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/hfsplus/dir.c b/fs/hfsplus/dir.c
index f0235c1..3074609 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -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);