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: <AM0PR04MB6004DF37314E8BF3812BC99CE700A@AM0PR04MB6004.eurprd04.prod.outlook.com>
Date:   Wed, 26 Jul 2023 06:43:11 +0000
From:   Gaurav Jain <gaurav.jain@....com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Horia Geanta <horia.geanta@....com>,
        Pankaj Gupta <pankaj.gupta@....com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
        Varun Sethi <V.Sethi@....com>,
        Meenakshi Aggarwal <meenakshi.aggarwal@....com>
Subject: RE: [EXT] [PATCH 1/2] crypto: caam - Use struct_size()

Reviewed-by: Gaurav Jain <gaurav.jain@....com>

> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Sent: Saturday, July 22, 2023 8:24 PM
> To: Horia Geanta <horia.geanta@....com>; Pankaj Gupta
> <pankaj.gupta@....com>; Gaurav Jain <gaurav.jain@....com>; Herbert Xu
> <herbert@...dor.apana.org.au>; David S. Miller <davem@...emloft.net>
> Cc: linux-kernel@...r.kernel.org; kernel-janitors@...r.kernel.org; Christophe
> JAILLET <christophe.jaillet@...adoo.fr>; linux-crypto@...r.kernel.org
> Subject: [EXT] [PATCH 1/2] crypto: caam - Use struct_size()
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
> 
> 
> Use struct_size() instead of hand-writing it, when allocating a structure with a
> flex array.
> 
> This is less verbose, more robust and more informative.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>  drivers/crypto/caam/caamhash.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
> index 80deb003f0a5..9e5924e24f2e 100644
> --- a/drivers/crypto/caam/caamhash.c
> +++ b/drivers/crypto/caam/caamhash.c
> @@ -708,9 +708,8 @@ static struct ahash_edesc *ahash_edesc_alloc(struct
> ahash_request *req,
>         gfp_t flags = (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
>                        GFP_KERNEL : GFP_ATOMIC;
>         struct ahash_edesc *edesc;
> -       unsigned int sg_size = sg_num * sizeof(struct sec4_sg_entry);
> 
> -       edesc = kzalloc(sizeof(*edesc) + sg_size, flags);
> +       edesc = kzalloc(struct_size(edesc, sec4_sg, sg_num), flags);
>         if (!edesc) {
>                 dev_err(ctx->jrdev, "could not allocate extended descriptor\n");
>                 return NULL;
> --
> 2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ