From: Philippe Mazenauer <philippe.mazenauer@outlook.de>
To: unlisted-recipients:; (no To-header on input)
Cc: "lee.jones@linaro.org" <lee.jones@linaro.org>,
Philippe Mazenauer <philippe.mazenauer@outlook.de>,
Theodore Ts'o <tytso@mit.edu>,
"Andreas Dilger" <adilger.kernel@dilger.ca>,
"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] ext4: Variable to signed to check return code
Date: Fri, 17 May 2019 09:01:32 +0000 [thread overview]
Message-ID: <AM0PR07MB4417C1C3A4E55EFE47027CA2FD0B0@AM0PR07MB4417.eurprd07.prod.outlook.com> (raw)
Variables 'n' and 'err' are both used for less-than-zero error checking,
however both are declared as unsigned. Ensure ext4_map_blocks() and
add_system_zone() are able to have their return values propagated
correctly by redefining them both as signed integers.
../fs/ext4/block_validity.c:158:9: warning: comparison of unsigned
expression < 0 is always false [-Wtype-limits]
if (n < 0) {
^
../fs/ext4/block_validity.c:173:12: warning: comparison of unsigned
expression < 0 is always false [-Wtype-limits]
if (err < 0)
^
Signed-off-by: Philippe Mazenauer <philippe.mazenauer@outlook.de>
---
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..678e99aeef1f 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;
+ int err = 0, n;
+ u32 i = 0, num;
if ((ino < EXT4_ROOT_INO) ||
(ino > le32_to_cpu(sbi->s_es->s_inodes_count)))
--
2.17.1
next reply other threads:[~2019-05-17 9:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 9:01 Philippe Mazenauer [this message]
2019-05-17 10:25 ` [PATCH] ext4: Variable to signed to check return code Lee Jones
2019-05-17 20:28 ` Theodore Ts'o
2019-05-18 6:38 ` Lee Jones
2019-05-18 19:54 ` Theodore Ts'o
2019-05-20 8:24 ` Lee Jones
2019-05-20 15:36 ` Theodore Ts'o
2019-05-21 7:25 ` Lee Jones
2019-05-21 17:16 ` Theodore Ts'o
2019-05-22 6:59 ` Lee Jones
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=AM0PR07MB4417C1C3A4E55EFE47027CA2FD0B0@AM0PR07MB4417.eurprd07.prod.outlook.com \
--to=philippe.mazenauer@outlook.de \
--cc=adilger.kernel@dilger.ca \
--cc=lee.jones@linaro.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).