All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] ext4: fix two cases where a u32 is being checked for a less than zero error return
@ 2019-04-26 22:09 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2019-04-26 22:09 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, linux-ext4
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There are two cases where u32 variables n and err are being checked
for less than zero error values, the checks is always false because
the variables are not signed. Fix this by making the variables ints.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/ext4/block_validity.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 968f163b5feb..8d03550aaae3 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -142,7 +142,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino)
 	struct inode *inode;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_map_blocks map;
-	u32 i = 0, err = 0, num, n;
+	u32 i = 0, num;
+	int err = 0, n;
 
 	if ((ino < EXT4_ROOT_INO) ||
 	    (ino > le32_to_cpu(sbi->s_es->s_inodes_count)))
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH][next] ext4: fix two cases where a u32 is being checked for a less than zero error return
@ 2019-04-26 22:09 ` Colin King
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King @ 2019-04-26 22:09 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, linux-ext4
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There are two cases where u32 variables n and err are being checked
for less than zero error values, the checks is always false because
the variables are not signed. Fix this by making the variables ints.

Addresses-Coverity: ("Unsigned compared against 0")
Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/ext4/block_validity.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
index 968f163b5feb..8d03550aaae3 100644
--- a/fs/ext4/block_validity.c
+++ b/fs/ext4/block_validity.c
@@ -142,7 +142,8 @@ static int ext4_protect_reserved_inode(struct super_block *sb, u32 ino)
 	struct inode *inode;
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_map_blocks map;
-	u32 i = 0, err = 0, num, n;
+	u32 i = 0, num;
+	int err = 0, n;
 
 	if ((ino < EXT4_ROOT_INO) ||
 	    (ino > le32_to_cpu(sbi->s_es->s_inodes_count)))
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] ext4: fix two cases where a u32 is being checked for a less than zero error return
  2019-04-26 22:09 ` Colin King
@ 2019-05-11  2:09   ` Theodore Ts'o
  -1 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2019-05-11  2:09 UTC (permalink / raw)
  To: Colin King; +Cc: Andreas Dilger, linux-ext4, kernel-janitors, linux-kernel

On Fri, Apr 26, 2019 at 11:09:08PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There are two cases where u32 variables n and err are being checked
> for less than zero error values, the checks is always false because
> the variables are not signed. Fix this by making the variables ints.
> 
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][next] ext4: fix two cases where a u32 is being checked for a less than zero error return
@ 2019-05-11  2:09   ` Theodore Ts'o
  0 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2019-05-11  2:09 UTC (permalink / raw)
  To: Colin King; +Cc: Andreas Dilger, linux-ext4, kernel-janitors, linux-kernel

On Fri, Apr 26, 2019 at 11:09:08PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There are two cases where u32 variables n and err are being checked
> for less than zero error values, the checks is always false because
> the variables are not signed. Fix this by making the variables ints.
> 
> Addresses-Coverity: ("Unsigned compared against 0")
> Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-11 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 22:09 [PATCH][next] ext4: fix two cases where a u32 is being checked for a less than zero error return Colin King
2019-04-26 22:09 ` Colin King
2019-05-11  2:09 ` Theodore Ts'o
2019-05-11  2:09   ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.