lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202312201046309071520@zte.com.cn>
Date: Wed, 20 Dec 2023 10:46:30 +0800 (CST)
From: <yang.guang5@....com.cn>
To: <harry.wentland@....com>
Cc: <jiang.xuexin@....com.cn>, <chen.haonan2@....com.cn>, <cgel.zte@...il.com>,
        <sunpeng.li@....com>, <rodrigo.siqueira@....com>,
        <alexander.deucher@....com>, <christian.koenig@....com>,
        <xinhui.pan@....com>, <airlied@...il.com>, <daniel@...ll.ch>,
        <alex.hung@....com>, <hamza.mahfooz@....com>, <wayne.lin@....com>,
        <hersenxs.wu@....com>, <srinivasan.shanmugam@....com>,
        <mario.limonciello@....com>, <amd-gfx@...ts.freedesktop.org>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH linux-next] drm/amd/display: use kcalloc instead of open coded arithmetic

From: Yang Guang <yang.guang5@....com.cn>

Dynamic size calculations (especially multiplication) should not be 
performed in memory allocator (or similar) function arguments due 
to the risk of them overflowing. This could lead to values wrapping 
around and a smaller allocation being made than the caller was 
expecting. Using those allocations could lead to linear overflows 
of heap memory and other misbehaviors. 

Signed-off-by: Chen Haonan <chen.haonan2@....com.cn>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index d7ac020bd8af..d6d63bd7482e 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9204,7 +9204,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 		 * Here we create an empty update on each plane.
 		 * To fix this, DC should permit updating only stream properties.
 		 */
-		dummy_updates = kzalloc(sizeof(struct dc_surface_update) * MAX_SURFACES, GFP_ATOMIC);
+		dummy_updates = kcalloc(MAX_SURFACES, sizeof(struct dc_surface_update), GFP_ATOMIC);
 		for (j = 0; j < status->plane_count; j++)
 			dummy_updates[j].surface = status->plane_states[0];

-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ