Re: [PATCH 2/2] crypto: omap: Improve a size determination in three functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 14, 2018 at 04:26:36PM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Wed, 14 Feb 2018 16:12:05 +0100
> 
> Replace the specification of data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/crypto/omap-aes.c  | 3 +--
>  drivers/crypto/omap-des.c  | 3 +--
>  drivers/crypto/omap-sham.c | 3 +--
>  3 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
> index a2bac3b869b6..82282a5e9b3f 100644
> --- a/drivers/crypto/omap-aes.c
> +++ b/drivers/crypto/omap-aes.c
> @@ -1032,14 +1032,13 @@ static int omap_aes_get_res_pdev(struct omap_aes_dev *dd,
>  static int omap_aes_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> -	struct omap_aes_dev *dd;
>  	struct crypto_alg *algp;
>  	struct aead_alg *aalg;
>  	struct resource res;
>  	int err = -ENOMEM, i, j, irq = -1;
>  	u32 reg;
> +	struct omap_aes_dev *dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
>  
> -	dd = devm_kzalloc(dev, sizeof(struct omap_aes_dev), GFP_KERNEL);

I'm fine with sizeof(*dd) but please don't combine the allocation
with the declaration.

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux