lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR07MB4417C1C3A4E55EFE47027CA2FD0B0@AM0PR07MB4417.eurprd07.prod.outlook.com>
Date:   Fri, 17 May 2019 09:01:32 +0000
From:   Philippe Mazenauer <philippe.mazenauer@...look.de>
To:     unlisted-recipients:; (no To-header on input)
CC:     "lee.jones@...aro.org" <lee.jones@...aro.org>,
        Philippe Mazenauer <philippe.mazenauer@...look.de>,
        Theodore Ts'o <tytso@....edu>,
        "Andreas Dilger" <adilger.kernel@...ger.ca>,
        "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] ext4: Variable to signed to check return code

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@...look.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ