Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4673464pxv; Tue, 20 Jul 2021 09:03:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8G0EDGjb42r+9PLnEmBGKsCv0JQZzGhgyl6M5f06CEx3uif+VoWt8SOSbSofKEFJmu7Tu X-Received: by 2002:a6b:8b0d:: with SMTP id n13mr22085225iod.169.1626797024786; Tue, 20 Jul 2021 09:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626797024; cv=none; d=google.com; s=arc-20160816; b=my/C/eCge/qUbN02SPtHCHqsM1u4v6AuGwVeyPG+5epRGbkqVre0NrHB3m8UIDVz/D 4i0FLvQiCy9GVPgCXq1Irr1h8gTw1i0GxlSoWE0ZowmJz91LmcbKLlr3I46tYXjPwoiN 4nBgBsbV5IkE2wSR8Eo19weZ2EqNgvxKtUzbjmRnBjU3AJmE7QN4cF3bvXtzxn8OmBVt +sEky6NKK7jsfumIM9QwAWWUFYVt5WxhSXQ8oqyy8+rONiSECG0v5J0V36QLvjHGKW4i XRA2tAgxz7y+5dJ06d+dbJYX2j2llEC/2K5e7i6kzEqV58bbiYmfO5JrIIWGw+0qe6vP 3v0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3II+PC97VCoKt9T8F7pnL4yTXL+6p6xVAwlLpzbPYU8=; b=P1XXVWjm0pbhrPxpAiSbCRWqfB2jZ0rmgwsriTK13ayx0LuaflDpBb7n7MVvQ3fDEK 2pcNDU1H3gk9eXx4BHOJE+3o5/ig5M+YC4e1fZ/2rVkKFkjN9L4c8tbDbMCDqy0K9Ntb iZJEM0L5qMw/5Ivz5Q+eueesuvGY2ZrQpFYQ+ZnfuCY5QyVUujXrwRzE9j+S3omxnwmR kJBoK3z8Gz+8NMeMv1OvdsW96M3MitMY4OKXfe7yQ3GpSsARSOaCpiAGxMZ+fAtybq/i AHLsyGjSwgPgxjoO0Jx7VgbppgRo/vFgByaQ+HpbRru8WfZbxPjISFCaNsYh4HChYYjs RM7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=wamHC7s9; 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=pass (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 f6si23692595jas.104.2021.07.20.09.03.27; Tue, 20 Jul 2021 09:03:44 -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; dkim=pass header.i=@canonical.com header.s=20210705 header.b=wamHC7s9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240163AbhGTPS6 (ORCPT + 99 others); Tue, 20 Jul 2021 11:18:58 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:38996 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234905AbhGTPRO (ORCPT ); Tue, 20 Jul 2021 11:17:14 -0400 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id EFFF2408B7; Tue, 20 Jul 2021 15:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626796652; bh=3II+PC97VCoKt9T8F7pnL4yTXL+6p6xVAwlLpzbPYU8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=wamHC7s9ZUcpEsWL5kOnny8dJU+Awirb8oRm5Y/2RXgjZks+aV2HQ4AeH20sGvBfr iKhGC44hNjMmWGN43/ATPYl6wJWfQAqCB1bdaCDGrSwlUgnRA0pblL5D5nAB+8lx8h ywKKsN+sAyQDiz1SIGH8oUU9j74gI1yoP+kZoVT0WORkTjdVC5omewH8nZB+hmmtjr jytKz61f4ZqLSA+xZa2XpSK1ppdU+nJEdGHkTggapNtj+tWO6bkIaWsPQcpyNRnPYD 0dkR4mBDPq3vhn4HA7FNTKggBMCUW3arWN1KeozryRPMx9AoC3FkjL70jdBLZNHz8R tO8eAJ/BfoBzA== From: Colin King To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Lucas De Marchi , Anusha Srivatsa , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] drm/i915/xelpd: Fix unsigned compared to less than zero error Date: Tue, 20 Jul 2021 16:57:26 +0100 Message-Id: <20210720155726.73628-1-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The subtraction of fw->size - offset is operating on two unsigned integers and the result is unsigned and hence the less than zero comparison will always to be false. Fix this by casting fw->size from a size_t to a ssize_t to ensure the result can be signed to allow a less than zero result. Addresses-Coverity: ("Unsigned compared against 0") Fixes: 3d5928a168a9 ("drm/i915/xelpd: Pipe A DMC plugging") Signed-off-by: Colin Ian King --- drivers/gpu/drm/i915/display/intel_dmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c index f8789d4543bf..dde1f243d375 100644 --- a/drivers/gpu/drm/i915/display/intel_dmc.c +++ b/drivers/gpu/drm/i915/display/intel_dmc.c @@ -645,7 +645,7 @@ static void parse_dmc_fw(struct drm_i915_private *dev_priv, continue; offset = readcount + dmc->dmc_info[id].dmc_offset * 4; - if (fw->size - offset < 0) { + if ((ssize_t)fw->size - offset < 0) { drm_err(&dev_priv->drm, "Reading beyond the fw_size\n"); continue; } -- 2.31.1