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>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 22 Feb 2024 23:00:03 -0600
From: Lucas De Marchi <lucas.demarchi@...el.com>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
CC: Erick Archer <erick.archer@....com>, Oded Gabbay <ogabbay@...nel.org>,
	Thomas Hellström <thomas.hellstrom@...ux.intel.com>, Maarten
 Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
	<mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, David Airlie
	<airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, "Gustavo A. R. Silva"
	<gustavoars@...nel.org>, Kees Cook <keescook@...omium.org>,
	<intel-xe@...ts.freedesktop.org>, <dri-devel@...ts.freedesktop.org>,
	<linux-kernel@...r.kernel.org>, <linux-hardening@...r.kernel.org>
Subject: Re: Re: [PATCH] drm/xe: Prefer struct_size over open coded arithmetic

On Sat, Feb 10, 2024 at 10:49:57AM -0600, Gustavo A. R. Silva wrote:
>
>
>On 2/10/24 08:19, Erick Archer wrote:
>>This is an effort to get rid of all multiplications from allocation
>>functions in order to prevent integer overflows [1].
>>
>>As the "q" variable is a pointer to "struct xe_exec_queue" and this
>>structure ends in a flexible array:
>>
>>struct xe_exec_queue {
>>	[...]
>>	struct xe_lrc lrc[];
>>};
>>
>>the preferred way in the kernel is to use the struct_size() helper to
>>do the arithmetic instead of the argument "size + size * count" in the
>>kzalloc() function.
>>
>>This way, the code is more readable and more safer.
>>
>>Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1]
>>Link: https://github.com/KSPP/linux/issues/160 [2]
>>Signed-off-by: Erick Archer <erick.archer@....com>
>
>LGTM:
>
>Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

applied to drm-xe-next. Thanks for the patch and review.

Lucas De Marchi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ