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: <20240822-atmen-geopolitisch-1c3dfe9b1179@brauner>
Date: Thu, 22 Aug 2024 11:12:39 +0200
From: Christian Brauner <brauner@...nel.org>
To: Yu Jiaoliang <yujiaoliang@...o.com>
Cc: Seth Forshee <sforshee@...nel.org>, 
	Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, linux-fsdevel@...r.kernel.org, 
	linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH v1] mnt_idmapping: Use kmemdup_array instead of kmemdup
 for multiple allocation

On Wed, Aug 21, 2024 at 05:15:07PM GMT, Yu Jiaoliang wrote:
> Let the kememdup_array() take care about multiplication and possible
> overflows.
> 
> Signed-off-by: Yu Jiaoliang <yujiaoliang@...o.com>
> ---
>  fs/mnt_idmapping.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/mnt_idmapping.c b/fs/mnt_idmapping.c
> index 3c60f1eaca61..fea0244a87ce 100644
> --- a/fs/mnt_idmapping.c
> +++ b/fs/mnt_idmapping.c
> @@ -228,9 +228,9 @@ static int copy_mnt_idmap(struct uid_gid_map *map_from,
>  		return 0;
>  	}
>  
> -	forward = kmemdup(map_from->forward,
> -			  nr_extents * sizeof(struct uid_gid_extent),
> -			  GFP_KERNEL_ACCOUNT);
> +	forward = kmemdup_array(map_from->forward, nr_extents,
> +				sizeof(struct uid_gid_extent),
> +				GFP_KERNEL_ACCOUNT);

Why did you only convert the forward array and not the reverse array?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ