Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp194856rwr; Wed, 19 Apr 2023 05:28:07 -0700 (PDT) X-Google-Smtp-Source: AKy350Y+lZYr9CE5/G7VS6M2n4K9eczF+A/8A0+wj43CEMZRgKv5QT8pHP+03IYtQPuc8IDyBgig X-Received: by 2002:a17:902:f54f:b0:1a6:81b5:9137 with SMTP id h15-20020a170902f54f00b001a681b59137mr6048894plf.68.1681907286994; Wed, 19 Apr 2023 05:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681907286; cv=none; d=google.com; s=arc-20160816; b=LIu5fXb/pB8JI1eIwIuf40wiAqV4ikQd1yJXTRNXeHR8nJgn9VYFBYPx8rIqk0rvnN nW3ylUxe7rJfkg6l2tZToOGUmiljHPzUx9QfPOYQVih2/yGi8YkB+D4kcmaH6mlOFOgx 8hd+MhJC5x5/7th4xsU2XFoPCeXCJ2Qbw1tuZLdyWbBefyCXw+4sRfOnkb4CqbH70NLs H9wQqSu2PXR0XB6uvu9yw28fe+z5I41+aJNzz4eCY61hj5LpPAlU8qjqu59dFPBZoNBi 97IjP+L6bTSRK2rdgNDM5LJ6vaSO1QkNKfbxnhB1sIljTATwem96TxHrlzV1D1B5eJHd O6bA== 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=vuo1R6zgWP4V7fxSrNGqI53skR4NUxsCW4UKtSQFHoQ=; b=JETn1rb2I+y5fQnnGjOgeWQAWEoOsqL7+0glfOUfpdVVzvKEKr4Ukw85YtwidXBUVE ZkbjJdhRD/75AnxxnBg7vgabeAw/zKl1MY7Qnb5Xf/m7htgD0Ag2l93/8BD4mj3togJY 3ssytW8+TWxpcQOHhLFHEe8a9JL6H+cIG81K5mdNhzdiW2cEbIQp4IY5C2fOZl9HLQmA gC4LU+lorCD6+XziVKtCjDEWOjC6muo29tQMh2Jg9BmkQPDZqheFva8LiSsOVgUagBvS GSTp75ntc08/Za22weOf5itKj1yXCPKOA3Z9QKJYrRpobZn8cYGD8970zydVDRMTpCr7 1oXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iHj2EFKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a170902ecce00b001a63e1de408si17468595plh.353.2023.04.19.05.27.52; Wed, 19 Apr 2023 05:28:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=iHj2EFKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232877AbjDSMXO (ORCPT + 99 others); Wed, 19 Apr 2023 08:23:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbjDSMXM (ORCPT ); Wed, 19 Apr 2023 08:23:12 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D51173B; Wed, 19 Apr 2023 05:23:11 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1a6ebc66ca4so15305505ad.3; Wed, 19 Apr 2023 05:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681906991; x=1684498991; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vuo1R6zgWP4V7fxSrNGqI53skR4NUxsCW4UKtSQFHoQ=; b=iHj2EFKwjqQG5zGuh91t/HLTjhn98+Tm/JgEUgdtKzQYUcMmigmjFwJZQ27nAG8Bnn RHiWrB3TM8X4DXmmFUxo4NXSXOgDWYjPdgXCG/SYRg/5s9pd4KEAOJnc20QtgnF8qg52 AUf1b2vXcFFtExWm9wshnbebzGLoILPKk6KmWinlkzij5YLgVKCJ7g26LmkyIfbTFQqg FLt59XmV42XHJ8E+dQGIJaHimuxqMmRFmogeMWa+pdUIzr2GIVnbyyyvr0DFJqmTfMVp 0L9i+faJHasd1uXPnVTW5t6+PMtY5Nt+W/N4+KxTV6QfESQ7rL+ImLHb+Q4igKn6JFDk v/TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681906991; x=1684498991; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vuo1R6zgWP4V7fxSrNGqI53skR4NUxsCW4UKtSQFHoQ=; b=WBTotO6ilhFoPv7Pgkrv7LyjG1vddWCnA7O7MP2f5IXW0/S8np961SYxTC3bZbPJ6y ENBOtSkbQt7nzk6OlI2mzLnQHHFvQTFwGPFTZTG/CHgpsUldqo5yLi8t4QRXjfygqF/k pasuFJXng208wYZwyrgZ+RPbDsoLeWj/uA3nACfam2kSgpgkFOUoMKqOBQpucku+I46R X+V/4op//PG6D25WZSl4nZ+7mv6SBtuhT8KQfBsHlNFLbcZ64A/KMiHJnQKqQaKM11L3 f0MfcuoBaxZBBJwFDBEAlUP7nL+nl+tSqNDqklKVjYhi3L98TaecRRGbSfxkcnQ2OvuD 8vPQ== X-Gm-Message-State: AAQBX9dQodrNQmJIDoLMNwyMnaoX+wJ+G8JAC8UTkRUdnHVoVT4362+8 sfkFdUTKppJqTYw0OKyOh6I= X-Received: by 2002:a17:902:c410:b0:1a1:f0ad:8657 with SMTP id k16-20020a170902c41000b001a1f0ad8657mr7207596plk.37.1681906990803; Wed, 19 Apr 2023 05:23:10 -0700 (PDT) Received: from hackyzh-virtual-machine.localdomain ([112.64.53.154]) by smtp.gmail.com with ESMTPSA id l11-20020a170902d34b00b0019c32968271sm9053670plk.11.2023.04.19.05.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 05:23:10 -0700 (PDT) From: hackyzh002 To: alexander.deucher@amd.com Cc: christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, sumit.semwal@linaro.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, hackyzh002 Subject: [PATCH v3 2/2] drm/amdgpu: Fix integer overflow in amdgpu_cs_pass1 Date: Wed, 19 Apr 2023 20:22:33 +0800 Message-Id: <20230419122233.3440-1-hackyzh002@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: hackyzh002 --- 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 08eced097..89bcacc65 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.34.1