From: Sergey Shtylyov <s.shtylyov@omp.ru> To: Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, <dm-devel@redhat.com> Cc: <linux-kernel@vger.kernel.org>, <lvc-patches@linuxtesting.org>, <lvc-patches@linuxtesting.org> Subject: [PATCH] md: dm-ioctl: drop always-false condition Date: Tue, 17 Jan 2023 23:59:55 +0300 [thread overview] Message-ID: <c8c9df45-1d59-3195-7631-51b3a58148ee@omp.ru> (raw) 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@omp.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; }
WARNING: multiple messages have this Message-ID (diff)
From: Sergey Shtylyov <s.shtylyov@omp.ru> To: Alasdair Kergon <agk@redhat.com>, Mike Snitzer <snitzer@kernel.org>, <dm-devel@redhat.com> Cc: lvc-patches@linuxtesting.org, linux-kernel@vger.kernel.org Subject: [dm-devel] [PATCH] md: dm-ioctl: drop always-false condition Date: Tue, 17 Jan 2023 23:59:55 +0300 [thread overview] Message-ID: <c8c9df45-1d59-3195-7631-51b3a58148ee@omp.ru> (raw) 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@omp.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; } -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
next reply other threads:[~2023-01-17 23:15 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-17 20:59 Sergey Shtylyov [this message] 2023-01-17 20:59 ` [dm-devel] [PATCH] md: dm-ioctl: drop always-false condition Sergey Shtylyov 2023-01-18 11:59 ` Mikulas Patocka 2023-01-18 11:59 ` Mikulas Patocka 2023-02-06 20:58 ` Sergey Shtylyov 2023-02-06 20:58 ` Sergey Shtylyov 2023-02-06 21:03 ` Mike Snitzer 2023-02-06 21:03 ` [dm-devel] " Mike Snitzer
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=c8c9df45-1d59-3195-7631-51b3a58148ee@omp.ru \ --to=s.shtylyov@omp.ru \ --cc=agk@redhat.com \ --cc=dm-devel@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=lvc-patches@linuxtesting.org \ --cc=snitzer@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.