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]
Message-ID: <fc165d83-bad2-2189-ec7d-2c756275d85c@amd.com>
Date:   Mon, 7 Feb 2022 09:01:48 +0100
From:   Christian König <christian.koenig@....com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Alex Deucher <alexander.deucher@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/radeon: Avoid open coded arithmetic in memory
 allocation

Am 05.02.22 um 18:38 schrieb Christophe JAILLET:
> kmalloc_array()/kcalloc() should be used to avoid potential overflow when
> a multiplication is needed to compute the size of the requested memory.
>
> So turn a kzalloc()+explicit size computation into an equivalent kcalloc().
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>

Reviewed-by: Christian König <christian.koenig@....com>

> ---
>   drivers/gpu/drm/radeon/radeon_atombios.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
> index 28c4413f4dc8..7b9cc7a9f42f 100644
> --- a/drivers/gpu/drm/radeon/radeon_atombios.c
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.c
> @@ -897,13 +897,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
>   	union atom_supported_devices *supported_devices;
>   	int i, j, max_device;
>   	struct bios_connector *bios_connectors;
> -	size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE;
>   	struct radeon_router router;
>   
>   	router.ddc_valid = false;
>   	router.cd_valid = false;
>   
> -	bios_connectors = kzalloc(bc_size, GFP_KERNEL);
> +	bios_connectors = kcalloc(ATOM_MAX_SUPPORTED_DEVICE,
> +				  sizeof(*bios_connectors), GFP_KERNEL);
>   	if (!bios_connectors)
>   		return false;
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ