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: <c8c9df45-1d59-3195-7631-51b3a58148ee@omp.ru>
Date:   Tue, 17 Jan 2023 23:59:55 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     Alasdair Kergon <agk@...hat.com>,
        Mike Snitzer <snitzer@...nel.org>, <dm-devel@...hat.com>
CC:     <linux-kernel@...r.kernel.org>, <lvc-patches@...uxtesting.org>,
        <lvc-patches@...uxtesting.org>
Subject: [PATCH] md: dm-ioctl: drop always-false condition

The expression 'indata[3] > ULONG_MAX' always evaluates to false since
indata[] is declared as an array of *unsigned long* elements and #define
ULONG_MAX represents the max value of that exact type...

Note that gcc seems to be able to detect the dead code here and eliminate
this check anyway...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@....ru>

---
This patch is atop of the 'for-next' branch of the device-mapper repo...

 drivers/md/dm-ioctl.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-dm/drivers/md/dm-ioctl.c
===================================================================
--- linux-dm.orig/drivers/md/dm-ioctl.c
+++ linux-dm/drivers/md/dm-ioctl.c
@@ -1073,8 +1073,7 @@ static int dev_set_geometry(struct file
 		goto out;
 	}
 
-	if (indata[0] > 65535 || indata[1] > 255 ||
-	    indata[2] > 255 || indata[3] > ULONG_MAX) {
+	if (indata[0] > 65535 || indata[1] > 255 || indata[2] > 255) {
 		DMERR("Geometry exceeds range limits.");
 		goto out;
 	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ