From patchwork Mon Sep 27 11:36:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 514676 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp4024138jao; Mon, 27 Sep 2021 04:36:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKcGLYzKzNJKDbOWcmqXA8jpPVqZuaraENbNNOnYAj81BuM/0nW6Ni6T0MQu861ya2sb1O X-Received: by 2002:a05:6402:50cc:: with SMTP id h12mr14991382edb.112.1632742599883; Mon, 27 Sep 2021 04:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632742599; cv=none; d=google.com; s=arc-20160816; b=AxSbcYV/ARzUczk/t8Mizo32UObD38LLiVLdgQ0MmSjZCDbwO9svTf59dmBl25YZN2 gQ4L7ztxh5DEcnlX6mDjZ+PwNEcVzcO4l2wIt0k5EVVsJQFy3rPjatnSn69o2aOu1bnu Yo2lWubCFFz5f6HYME5afqUIVqx4gz36PwC7ZdN7XU9eX3QFs7zpAW4NFIFhv4+azzhX iQuqpen6xf0YTT9T1oTMTiL6mj39SCPaOBCH/lHd0bu5ccIrdRFjkfA8HVtwJtjOKhcE Z5neTSD54wGzmE0B4cUXd8kVDhlCJ3EIkO3YpoFIuUDhUTc+B2Q6fqvsWttFu+M3+qKp fPmA== 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=hBpnm7Sfm0ml+PnxGB+CoaLrpSEYAFdwCwSJ18ZzX+0=; b=pHIBR5PQqkSyrvdiZ9fiValSolmkfJiUvILecRjI+uQEvU3bwgJMc5v0CNN1diizu5 HDpe/bkUMWpQgNlBtnpdcuoEvGr69dqSSU7yj9ZUYpBNsAtRQTiJoFaqOLI67Nizd+qF 5vUkICsyYs8uHrtP6UTLJmrpX5bX1HaeqdxwUQM3SUBqcbufxOcdVxKxFj8zuU9Lbxvp 7/nioTOxEV7zpkbKewCakcGwM3Rt3o0hHJ1QATgeJ2yPQaeENkwXYc5xqMWwD2kq7BTK 2f404pfLvLSeYdXzMGepa9Lpji2j5uTvmTkHqCHwnFWRZeQh/9mRW/wLhFODTraH1Cgj oUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GIRQdOlW; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si7398229edn.269.2021.09.27.04.36.39; Mon, 27 Sep 2021 04:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@kernel.org header.s=k20201202 header.b=GIRQdOlW; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234097AbhI0LiP (ORCPT + 17 others); Mon, 27 Sep 2021 07:38:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:43108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234075AbhI0LiP (ORCPT ); Mon, 27 Sep 2021 07:38:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED57060F58; Mon, 27 Sep 2021 11:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632742597; bh=Rl3OTC7V1DvxO5S+CLcKb/G4xypiFLCG7rhJzIouM9o=; h=From:To:Cc:Subject:Date:From; b=GIRQdOlWtQeOMLb+VYfzHERHrDKA38VhnFhqfoB27L2ZztW1kG/YwfGnx8+bG5m2w tIDcTjzg8OBfBy9I1T9duPEeXgoEHSjzRE69zF4UJ7AN7s9NWuE0m658Wci7xL0xai ea0aXKeWWRmrVH1JbjRfizMoUuLHo3hr8X0TrZixmNsPDHbeeIng78GbIcOuvMrqu8 SE4vg9tVwLTVvaJB9O6sjiGoXNzhsd0WjChOtXE+Iu3PjfXtqu4Gt2Iej5V8WYyQ4x +/9bhZDBAYhH7wIdixdaYvEL5yVXxdw563oV7wHam7QvEezxKicYyfyS58W33vgEEx LNh6HRkSCn50A== From: Arnd Bergmann To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Nathan Chancellor , Nick Desaulniers , "Kristian H. Kristensen" Cc: Arnd Bergmann , =?utf-8?q?Christian_K=C3=B6nig?= , Jordan Crouse , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures Date: Mon, 27 Sep 2021 13:36:23 +0200 Message-Id: <20210927113632.3849987-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Arnd Bergmann The overflow check does causes a warning from clang-14 when 'sz' is a type that is smaller than size_t: drivers/gpu/drm/msm/msm_gem_submit.c:217:10: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (sz == SIZE_MAX) { Change the type accordingly. Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.29.2 Reviewed-by: Stephen Boyd diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index fdc5367aecaa..ac23bbdb0bab 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -171,7 +171,8 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, static int submit_lookup_cmds(struct msm_gem_submit *submit, struct drm_msm_gem_submit *args, struct drm_file *file) { - unsigned i, sz; + unsigned i; + size_t sz; int ret = 0; for (i = 0; i < args->nr_cmds; i++) {