Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp598391ybt; Wed, 17 Jun 2020 09:03:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaMRSuubn1509iyvyBYUYx8pLh4jPvA1/W7Cuc9CuDxQXUd37goeq1w1mgqpcrdyq0Rs3i X-Received: by 2002:a17:906:39b:: with SMTP id b27mr8009885eja.421.1592409815716; Wed, 17 Jun 2020 09:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592409815; cv=none; d=google.com; s=arc-20160816; b=IUbYVL3vvU7XB4n1835n1YUEEy9i9+upoiSU+UTqtLqNGZjrDPYlLYnxBcMkPMXaUh 5nKho3+zKqPsKAo5GYTltsn1v9+mouxOtVqdzip/6qDzhkNvuImMEEvxgLTyGB1tKIpr 7Z3l3iIjSfq0BUK2lg7goLQy59XCTtpQZKFwborp5g0MgtempA/tWJ9zG1huSLi80fC2 cV2bo2DK2R3/zXXTaenuXU5rFOjG1/bkHmv6+Wr4sXeKY8J73fUOOxJbuG6mYNs9+WEx eEO9CP2iUyblWAsg1jQvRrP23tcu+znNZKEDbhGMCE7esS1uiliSzbVcJj1Uox9i0kNQ lSOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=u53alQfwXBFRoFDpCUvh+A3/m+YgFOGOFPJ2AkB30/k=; b=uM5kUVeNyEBTtKPBlOI6EC0k+dgzHiDwb6EMQ++hQEnWI0FUdufbSAov5Xi0wx/SL7 71YFl2LU8y+6+F8jQIhI41ar1a5YDGUyw88YmLqxRfIV3B6ankJ07lRSU50atFCvusEz gdC29/+Fs1cST0l3IRfWvb4Qb1fZYE8ECQOw7938EB/lYsy1b0/bRlPleKvRg54hla5Q RgIe+/ANDGZJirrSqooPLcfWe8JXgocI1buzS8Npds+YFFUS/Xtv7zh3VgwuBFxIDMKH 2BUiOKXUMhyYEWcJBADdVC2zYHjyrs0mMeKj/yb2PvY+4+P/GnuKt9dC9eSzsqUUtkht GN6Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si148345ejx.323.2020.06.17.09.03.10; Wed, 17 Jun 2020 09:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726926AbgFQQAL (ORCPT + 99 others); Wed, 17 Jun 2020 12:00:11 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:45563 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgFQQAK (ORCPT ); Wed, 17 Jun 2020 12:00:10 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jlaTo-0003xt-5r; Wed, 17 Jun 2020 16:00:00 +0000 From: Colin King To: David Airlie , Daniel Vetter , =?UTF-8?q?Christian=20K=C3=B6nig?= , dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] drm/mm/selftests: fix unsigned comparison with less than zero Date: Wed, 17 Jun 2020 16:59:59 +0100 Message-Id: <20200617155959.231740-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0.rc0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King 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 --- 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", -- 2.27.0.rc0