From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (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 finch.gentoo.org (Postfix) with ESMTPS id 2A8B915838C for ; Fri, 26 Jan 2024 22:48:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3C818E29D7; Fri, 26 Jan 2024 22:48:42 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0FE16E29D7 for ; Fri, 26 Jan 2024 22:48:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D8B4434336C for ; Fri, 26 Jan 2024 22:48:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4B446EC0 for ; Fri, 26 Jan 2024 22:48:39 +0000 (UTC) From: "Mike Pagano" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Pagano" Message-ID: <1706309303.31b6dfccf106853fa2a070de8cece9ea4761629c.mpagano@gentoo> Subject: [gentoo-commits] proj/linux-patches:6.6 commit in: / X-VCS-Repository: proj/linux-patches X-VCS-Files: 0000_README 2800_amdgpu-Adj-kmalloc-array-calls-for-new-Walloc-size.patch X-VCS-Directories: / X-VCS-Committer: mpagano X-VCS-Committer-Name: Mike Pagano X-VCS-Revision: 31b6dfccf106853fa2a070de8cece9ea4761629c X-VCS-Branch: 6.6 Date: Fri, 26 Jan 2024 22:48:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ffcde0fc-e569-4653-b7a0-7599c425fb8c X-Archives-Hash: 594c346f9ec0e255b8442ca907f62cb3 commit: 31b6dfccf106853fa2a070de8cece9ea4761629c Author: Mike Pagano gentoo org> AuthorDate: Fri Jan 26 22:48:23 2024 +0000 Commit: Mike Pagano gentoo org> CommitDate: Fri Jan 26 22:48:23 2024 +0000 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=31b6dfcc amdgpu: Adjust kmalloc_array calls for new -Walloc-size Signed-off-by: Mike Pagano gentoo.org> 0000_README | 4 + ...j-kmalloc-array-calls-for-new-Walloc-size.patch | 124 +++++++++++++++++++++ 2 files changed, 128 insertions(+) diff --git a/0000_README b/0000_README index 03172d84..b187f62e 100644 --- a/0000_README +++ b/0000_README @@ -115,6 +115,10 @@ Patch: 2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch From: https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-marcel@holtmann.org/raw Desc: Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. See bug #686758 +Patch: 2800_amdgpu-Adj-kmalloc-array-calls-for-new-Walloc-size.patch +From: sam@gentoo.org +Desc: amdgpu: Adjust kmalloc_array calls for new -Walloc-size + Patch: 2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch From: https://bugs.gentoo.org/710790 Desc: tmp513 requies REGMAP_I2C to build. Select it by default in Kconfig. See bug #710790. Thanks to Phil Stracchino diff --git a/2800_amdgpu-Adj-kmalloc-array-calls-for-new-Walloc-size.patch b/2800_amdgpu-Adj-kmalloc-array-calls-for-new-Walloc-size.patch new file mode 100644 index 00000000..798ac040 --- /dev/null +++ b/2800_amdgpu-Adj-kmalloc-array-calls-for-new-Walloc-size.patch @@ -0,0 +1,124 @@ +From: Sam James +To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org +Cc: linux-kernel@vger.kernel.org, Sam James +Subject: [PATCH] amdgpu: Adjust kmalloc_array calls for new -Walloc-size +Date: Sun, 5 Nov 2023 16:06:50 +0000 [thread overview] +Message-ID: <20231105160652.374422-1-sam@gentoo.org> (raw) +In-Reply-To: <87wmuwo7i3.fsf@gentoo.org> + +GCC 14 introduces a new -Walloc-size included in -Wextra which errors out +on various files in drivers/gpu/drm/amd/amdgpu like: +``` +amdgpu_amdkfd_gfx_v8.c:241:15: error: allocation of insufficient size ‘4’ for type ‘uint32_t[2]’ {aka ‘unsigned int[2]'} with size ‘8’ [-Werror=alloc-size] +``` + +This is because each HQD_N_REGS is actually a uint32_t[2]. Move the * 2 to +the size argument so GCC sees we're allocating enough. + +Originally did 'sizeof(uint32_t) * 2' for the size but a friend suggested +'sizeof(**dump)' better communicates the intent. + +Link: https://lore.kernel.org/all/87wmuwo7i3.fsf@gentoo.org/ +Signed-off-by: Sam James +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 2 +- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gc_9_4_3.c | 2 +- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 4 ++-- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c | 4 ++-- + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 4 ++-- + 5 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +index 625db444df1c..0ba15dcbe4e1 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +@@ -200,7 +200,7 @@ int kgd_arcturus_hqd_sdma_dump(struct amdgpu_device *adev, + #undef HQD_N_REGS + #define HQD_N_REGS (19+6+7+10) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gc_9_4_3.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gc_9_4_3.c +index 490c8f5ddb60..ca7238b5535b 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gc_9_4_3.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gc_9_4_3.c +@@ -141,7 +141,7 @@ static int kgd_gfx_v9_4_3_hqd_sdma_dump(struct amdgpu_device *adev, + (*dump)[i++][1] = RREG32(addr); \ + } while (0) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +index 6bf448ab3dff..ca4a6b82817f 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +@@ -214,7 +214,7 @@ static int kgd_hqd_dump(struct amdgpu_device *adev, + (*dump)[i++][1] = RREG32(addr); \ + } while (0) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +@@ -301,7 +301,7 @@ static int kgd_hqd_sdma_dump(struct amdgpu_device *adev, + #undef HQD_N_REGS + #define HQD_N_REGS (19+4) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c +index cd06e4a6d1da..0f3e2944edd7 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c +@@ -238,7 +238,7 @@ static int kgd_hqd_dump(struct amdgpu_device *adev, + (*dump)[i++][1] = RREG32(addr); \ + } while (0) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +@@ -324,7 +324,7 @@ static int kgd_hqd_sdma_dump(struct amdgpu_device *adev, + #undef HQD_N_REGS + #define HQD_N_REGS (19+4+2+3+7) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +index 51011e8ee90d..a3355b90aac5 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +@@ -365,7 +365,7 @@ int kgd_gfx_v9_hqd_dump(struct amdgpu_device *adev, + (*dump)[i++][1] = RREG32(addr); \ + } while (0) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +@@ -462,7 +462,7 @@ static int kgd_hqd_sdma_dump(struct amdgpu_device *adev, + #undef HQD_N_REGS + #define HQD_N_REGS (19+6+7+10) + +- *dump = kmalloc_array(HQD_N_REGS * 2, sizeof(uint32_t), GFP_KERNEL); ++ *dump = kmalloc_array(HQD_N_REGS, sizeof(**dump), GFP_KERNEL); + if (*dump == NULL) + return -ENOMEM; + +-- +2.42.1