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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 May 2022 10:01:00 +0530
From:   Ritesh Harjani <ritesh.list@...il.com>
To:     Shuqi Zhang <zhangshuqi3@...wei.com>
Cc:     linux-ext4@...r.kernel.org, adilger.kernel@...ger.ca, tytso@....edu
Subject: Re: [PATCH] ext4: Use kmemdup() to replace kmalloc + memcpy

On 22/05/25 11:01AM, Shuqi Zhang wrote:
> Replace kmalloc + memcpy with kmemdup()

Thanks for the patch. A straight forward conversion.

Looks good to me. Feel free to add -

Reviewed-by: Ritesh Harjani <ritesh.list@...il.com>

>
> Signed-off-by: Shuqi Zhang <zhangshuqi3@...wei.com>
> ---
>  fs/ext4/xattr.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 042325349098..564e28a1aa94 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -1895,11 +1895,10 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
>
>  			unlock_buffer(bs->bh);
>  			ea_bdebug(bs->bh, "cloning");
> -			s->base = kmalloc(bs->bh->b_size, GFP_NOFS);
> +			s->base = kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS);
>  			error = -ENOMEM;
>  			if (s->base == NULL)
>  				goto cleanup;
> -			memcpy(s->base, BHDR(bs->bh), bs->bh->b_size);
>  			s->first = ENTRY(header(s->base)+1);
>  			header(s->base)->h_refcount = cpu_to_le32(1);
>  			s->here = ENTRY(s->base + offset);
> --
> 2.31.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ