mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ashwin-h <ashwinh@vmware.com>
To: <tytso@mit.edu>, <adilger.kernel@dilger.ca>
Cc: <linux-ext4@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@kernel.org>, <srivatsab@vmware.com>,
	<srivatsa@csail.mit.edu>, <rostedt@goodmis.org>,
	<srostedt@vmware.com>, <gregkh@linuxfoundation.org>,
	<ashwin.hiranniah@gmail.com>,
	Colin Ian King <colin.king@canonical.com>,
	Ashwin H <ashwinh@vmware.com>
Subject: [PATCH 5/5] ext4: unsigned int compared against zero
Date: Thu, 30 Apr 2020 09:52:07 +0530	[thread overview]
Message-ID: <7467cc4a8a1fcb2cf1d3de1c12ed1c8b1d86d47e.1588189373.git.ashwinh@vmware.com> (raw)
In-Reply-To: <cover.1588189373.git.ashwinh@vmware.com>

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

commit fbbbbd2f28aec991f3fbc248df211550fbdfd58c upstream.

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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ashwin H <ashwinh@vmware.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 7ba8920..13eb028 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.7.4


  parent reply	other threads:[~2020-04-29 20:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  4:22 [PATCH 0/5] Backport to 4.14 - ext4: protect journal inode's blocks using block_validity ashwin-h
2020-04-30  4:22 ` [PATCH 1/5] ext4: avoid declaring fs inconsistent due to invalid file handles ashwin-h
2020-04-30  4:22 ` [PATCH 2/5] ext4: protect journal inode's blocks using block_validity ashwin-h
2020-04-30  4:22 ` [PATCH 3/5] ext4: don't perform block validity checks on the journal inode ashwin-h
2020-04-30  4:22 ` [PATCH 4/5] ext4: fix block validity checks for journal inodes using indirect blocks ashwin-h
2020-04-30  4:22 ` ashwin-h [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-04-30  4:35 [PATCH 0/5] Backport to 4.4 - ext4: protect journal inode's blocks using block_validity ashwin-h
2020-04-30  4:35 ` [PATCH 5/5] ext4: unsigned int compared against zero ashwin-h
2020-04-29 19:21 [PATCH 0/5] Backport to 4.9- ext4: protect journal inode's blocks using block_validity ashwin-h
2020-04-29 19:21 ` [PATCH 5/5] ext4: unsigned int compared against zero ashwin-h

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7467cc4a8a1fcb2cf1d3de1c12ed1c8b1d86d47e.1588189373.git.ashwinh@vmware.com \
    --to=ashwinh@vmware.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=ashwin.hiranniah@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=srivatsa@csail.mit.edu \
    --cc=srivatsab@vmware.com \
    --cc=srostedt@vmware.com \
    --cc=stable@kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®