From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E1181171A for ; Mon, 21 Aug 2023 20:00:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 943BBC433C7; Mon, 21 Aug 2023 20:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1692648038; bh=yN0Qbu3MNrxECrvA/lD3XzmCkQrnz2Kz6CXdweZaKpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbVgBNPAZu+mocsYJ72wCTcl1O72vDBzrhD4ncqIZDlMIeQKt1GHZcvj2kBH+TDWd BA+Ss/CzH6DEPcW3D7FoSUs0Ls8LT9YqRlxwpnGM8/WopkfjtlOkUbZcAIxafG1r/Q HdNoLAqS5er1Ssta2LM7OIuTR8Qz8JiANg6layak= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Christian=20K=C3=B6nig?= , hackyzh002 , Alex Deucher , Sasha Levin Subject: [PATCH 6.4 007/234] drm/amdgpu: Fix integer overflow in amdgpu_cs_pass1 Date: Mon, 21 Aug 2023 21:39:30 +0200 Message-ID: <20230821194129.074478478@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821194128.754601642@linuxfoundation.org> References: <20230821194128.754601642@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 a989ae72a58a9..feb48bb0b4494 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -189,7 +189,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.40.1