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]
Message-ID: <20210927133807.rtkfjkxxlwpdqcnf@scouring>
Date:   Mon, 27 Sep 2021 08:38:07 -0500
From:   Nishanth Menon <nm@...com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
CC:     <kristo@...nel.org>, <ssantosh@...nel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] firmware: ti_sci: Use devm_bitmap_zalloc when applicable

On 14:36-20210926, Christophe JAILLET wrote:
> 'xfer_alloc_table' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify
> code and improve the semantic of the code.
> 
> While at it, remove a redundant 'bitmap_zero()' call.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>  drivers/firmware/ti_sci.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 235c7e7869aa..a33eb884102f 100644
> --- a/drivers/firmware/ti_sci.c
> +++ b/drivers/firmware/ti_sci.c
> @@ -3352,13 +3352,11 @@ static int ti_sci_probe(struct platform_device *pdev)
>  	if (!minfo->xfer_block)
>  		return -ENOMEM;
>  
> -	minfo->xfer_alloc_table = devm_kcalloc(dev,
> -					       BITS_TO_LONGS(desc->max_msgs),
> -					       sizeof(unsigned long),
> -					       GFP_KERNEL);
> +	minfo->xfer_alloc_table = devm_bitmap_zalloc(dev,
> +						     desc->max_msgs,
> +						     GFP_KERNEL);
>  	if (!minfo->xfer_alloc_table)
>  		return -ENOMEM;
> -	bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
>  
>  	/* Pre-initialize the buffer pointer to pre-allocated buffers */
>  	for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
> -- 
> 2.30.2
> 

Reviewed-by: Nishanth Menon <nm@...com>

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ