Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300135 > unrolled thread

[PATCH] ubifs: Fix error codes in ubifs_iget()

Started byRichard Weinberger <richard@nod.at>
First post2016-01-02 23:20 +0100
Last post2016-01-03 15:00 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ubifs: Fix error codes in ubifs_iget() Richard Weinberger <richard@nod.at> - 2016-01-02 23:20 +0100
    Re: [PATCH] ubifs: Fix error codes in ubifs_iget() Richard Weinberger <richard@nod.at> - 2016-01-03 15:00 +0100
    Re: [PATCH] ubifs: Fix error codes in ubifs_iget() Artem Bityutskiy <dedekind1@gmail.com> - 2016-01-03 15:00 +0100
      Re: [PATCH] ubifs: Fix error codes in ubifs_iget() Artem Bityutskiy <dedekind1@gmail.com> - 2016-01-03 15:00 +0100

#1300135 — [PATCH] ubifs: Fix error codes in ubifs_iget()

FromRichard Weinberger <richard@nod.at>
Date2016-01-02 23:20 +0100
Subject[PATCH] ubifs: Fix error codes in ubifs_iget()
Message-ID<qMCGJ-5oA-3@gated-at.bofh.it>
We cannot use positive error codes in ERR_PTR().
IS_ERR() won't catch them.

Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger <richard@nod.at>
---
 fs/ubifs/super.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 1fd90c0..c7d8230 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -173,7 +173,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 			memcpy(ui->data, ino->data, ui->data_len);
 			((char *)ui->data)[ui->data_len] = '\0';
 		} else if (ui->data_len != 0) {
-			err = 10;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		break;
@@ -181,14 +181,14 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 		inode->i_op  = &ubifs_dir_inode_operations;
 		inode->i_fop = &ubifs_dir_operations;
 		if (ui->data_len != 0) {
-			err = 11;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		break;
 	case S_IFLNK:
 		inode->i_op = &ubifs_symlink_inode_operations;
 		if (ui->data_len <= 0 || ui->data_len > UBIFS_MAX_INO_DATA) {
-			err = 12;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		ui->data = kmalloc(ui->data_len + 1, GFP_NOFS);
@@ -218,7 +218,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 		else if (ui->data_len == sizeof(dev->huge))
 			rdev = huge_decode_dev(le64_to_cpu(dev->huge));
 		else {
-			err = 13;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		memcpy(ui->data, ino->data, ui->data_len);
@@ -231,12 +231,12 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 		inode->i_op = &ubifs_file_inode_operations;
 		init_special_inode(inode, inode->i_mode, 0);
 		if (ui->data_len != 0) {
-			err = 14;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		break;
 	default:
-		err = 15;
+		err = -EINVAL;
 		goto out_invalid;
 	}
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1300302

FromRichard Weinberger <richard@nod.at>
Date2016-01-03 15:00 +0100
Message-ID<qMRmp-69u-1@gated-at.bofh.it>
In reply to#1300135
Am 03.01.2016 um 14:54 schrieb Artem Bityutskiy:
> On Sun, 2016-01-03 at 15:51 +0200, Artem Bityutskiy wrote:
>> On Sat, 2016-01-02 at 23:11 +0100, Richard Weinberger wrote:
>>> We cannot use positive error codes in ERR_PTR().
>>> IS_ERR() won't catch them.
>>
>> Right, but why there is a "err = -EINVAL;" when at 'out_invalid'.
> 
> Sorry Richard, I edited the sentence and did not notice it was messy.
> 
> Here is what I wanted to say: right, but there is a "err = -EINVAL' at
> the end of 'out_invalid'.

Oh, you're right. I've missed this somehow.
Let's ignore this patch. :)

Thanks,
//richard


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300303

FromArtem Bityutskiy <dedekind1@gmail.com>
Date2016-01-03 15:00 +0100
Message-ID<qMRmp-69u-3@gated-at.bofh.it>
In reply to#1300135
On Sat, 2016-01-02 at 23:11 +0100, Richard Weinberger wrote:
> We cannot use positive error codes in ERR_PTR().
> IS_ERR() won't catch them.

Right, but why there is a "err = -EINVAL;" when at 'out_invalid'.

> Cc: stable@vger.kernel.org
> Signed-off-by: Richard Weinberger <richard@nod.at>

I do not see a bug, but I see a removal of a useful code which lets you
understand what verification failed. Do I miss something?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300304

FromArtem Bityutskiy <dedekind1@gmail.com>
Date2016-01-03 15:00 +0100
Message-ID<qMRmq-69u-5@gated-at.bofh.it>
In reply to#1300303
On Sun, 2016-01-03 at 15:51 +0200, Artem Bityutskiy wrote:
> On Sat, 2016-01-02 at 23:11 +0100, Richard Weinberger wrote:
> > We cannot use positive error codes in ERR_PTR().
> > IS_ERR() won't catch them.
> 
> Right, but why there is a "err = -EINVAL;" when at 'out_invalid'.

Sorry Richard, I edited the sentence and did not notice it was messy.

Here is what I wanted to say: right, but there is a "err = -EINVAL' at
the end of 'out_invalid'.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web