lkml.org 
[lkml]   [2023]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [dm-devel] [PATCH] md: dm-ioctl: drop always-false condition


On Tue, 17 Jan 2023, Sergey Shtylyov wrote:

> 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>

Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>

> ---
> 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
>

\
 
 \ /
  Last update: 2023-03-26 23:45    [W:0.573 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site