kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Colin King <colin.king@canonical.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] drm/mm/selftests: fix unsigned comparison with less than zero
Date: Sun, 21 Jun 2020 15:33:01 +0000	[thread overview]
Message-ID: <feb9dc72-c6e8-b745-ca90-b4ff7021d7bd@amd.com> (raw)
In-Reply-To: <20200617155959.231740-1-colin.king@canonical.com>

Am 17.06.20 um 17:59 schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> Function get_insert_time can return error values that are cast
> to a u64. The checks of insert_time1 and insert_time2 check for
> the errors but because they are u64 variables the check for less
> than zero can never be true. Fix this by casting the value to s64
> to allow of the negative error check to succeed.
>
> Addresses-Coverity: ("Unsigned compared against 0, no effect")
> Fixes: 6e60d5ded06b ("drm/mm: add ig_frag selftest")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

Going to pick that up for drm-misc-fixes tomorrow.

> ---
>   drivers/gpu/drm/selftests/test-drm_mm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c
> index 3846b0f5bae3..671a152a6df2 100644
> --- a/drivers/gpu/drm/selftests/test-drm_mm.c
> +++ b/drivers/gpu/drm/selftests/test-drm_mm.c
> @@ -1124,12 +1124,12 @@ static int igt_frag(void *ignored)
>   
>   		insert_time1 = get_insert_time(&mm, insert_size,
>   					       nodes + insert_size, mode);
> -		if (insert_time1 < 0)
> +		if ((s64)insert_time1 < 0)
>   			goto err;
>   
>   		insert_time2 = get_insert_time(&mm, (insert_size * 2),
>   					       nodes + insert_size * 2, mode);
> -		if (insert_time2 < 0)
> +		if ((s64)insert_time2 < 0)
>   			goto err;
>   
>   		pr_info("%s fragmented insert of %u and %u insertions took %llu and %llu nsecs\n",

      parent reply	other threads:[~2020-06-21 15:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 15:59 [PATCH][next] drm/mm/selftests: fix unsigned comparison with less than zero Colin King
2020-06-18 10:39 ` Dan Carpenter
2020-06-21 21:38   ` Nirmoy
2020-06-21 15:33 ` Christian König [this message]

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=feb9dc72-c6e8-b745-ca90-b4ff7021d7bd@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@linux.ie \
    --cc=colin.king@canonical.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.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: 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).