From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 432B1C001DF for ; Mon, 24 Jul 2023 01:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbjGXBOT (ORCPT ); Sun, 23 Jul 2023 21:14:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbjGXBOM (ORCPT ); Sun, 23 Jul 2023 21:14:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44B1AE4A; Sun, 23 Jul 2023 18:14:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBA7E60F02; Mon, 24 Jul 2023 01:13:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6D8FC433C8; Mon, 24 Jul 2023 01:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690161239; bh=VP7xfuHDmq0OQ+Wm2bMJRWf/CZ8k3F9XkTXxs9Z2R3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g7QiEpW7Y/mG3sF3R0g3ad/KjghsgZip87VJQhLChaEs67CpUO6yOadLnE/gQ6KIA N6Njr4lgb9ohQX29LMe6Cps4De5wJZFvTyY4NkzgBRoZxQPEiq/Ibl5h5nrCs8ILVw qfWKKXWGPCawL7KIlzONUAl0ZFQvBsNjjLHuVbn/AOOINhruK12bXNMW7r2NUiursg lyCkx6wqcWaJXuhfxMTQOs/GYQtvwlRoVjcr6ZOR/M1evLs3ZVXNPdohCJzxI6dOjc BeLHExOXd5JzVmSBSN3YBp9h8okfnVzJCO7Qm0OMnLPWlDrV50fHDEzirioAwrHJrL dQxmDekkJmgww== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: hackyzh002 , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin , Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, luben.tuikov@amd.com, guchun.chen@amd.com, Felix.Kuehling@amd.com, dongchenchen2@huawei.com, Philip.Yang@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.4 06/58] drm/amdgpu: Fix integer overflow in amdgpu_cs_pass1 Date: Sun, 23 Jul 2023 21:12:34 -0400 Message-Id: <20230724011338.2298062-6-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230724011338.2298062-1-sashal@kernel.org> References: <20230724011338.2298062-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.4.5 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: hackyzh002 [ Upstream commit 87c2213e85bd81e4a9a4d0880c256568794ae388 ] The type of size is unsigned int, if size is 0x40000000, there will be an integer overflow, size will be zero after size *= sizeof(uint32_t), will cause uninitialized memory to be referenced later. Reviewed-by: Christian König Signed-off-by: hackyzh002 Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 2eb2c66843a88..d3b7148a4e30f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -192,7 +192,7 @@ static int amdgpu_cs_pass1(struct amdgpu_cs_parser *p, uint64_t *chunk_array_user; uint64_t *chunk_array; uint32_t uf_offset = 0; - unsigned int size; + size_t size; int ret; int i; -- 2.39.2