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:   Thu, 23 Jul 2020 11:54:24 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Tomas Winkler <tomas.winkler@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Alexander Usyskin <alexander.usyskin@...el.com>,
        linux-kernel@...r.kernel.org,
        "Gustavo A . R . Silva" <gustavoars@...nel.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: Re: [char-misc-next 4/6] mei: client: use sizeof of variable instead
 of struct type



On 7/23/20 09:59, Tomas Winkler wrote:
> There is a possibility of bug when variable type has changed but
> corresponding struct passed to the sizeof has not.
> 
> Cc: Gustavo A. R. Silva <gustavoars@...nel.org>
> Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thanks
--
Gustavo

> ---
>  drivers/misc/mei/client.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
> index b32c825a0945..2572887d99b6 100644
> --- a/drivers/misc/mei/client.c
> +++ b/drivers/misc/mei/client.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * Copyright (c) 2003-2019, Intel Corporation. All rights reserved.
> + * Copyright (c) 2003-2020, Intel Corporation. All rights reserved.
>   * Intel Management Engine Interface (Intel MEI) Linux driver
>   */
>  
> @@ -369,7 +369,7 @@ static struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl,
>  {
>  	struct mei_cl_cb *cb;
>  
> -	cb = kzalloc(sizeof(struct mei_cl_cb), GFP_KERNEL);
> +	cb = kzalloc(sizeof(*cb), GFP_KERNEL);
>  	if (!cb)
>  		return NULL;
>  
> @@ -552,7 +552,7 @@ int mei_cl_flush_queues(struct mei_cl *cl, const struct file *fp)
>   */
>  static void mei_cl_init(struct mei_cl *cl, struct mei_device *dev)
>  {
> -	memset(cl, 0, sizeof(struct mei_cl));
> +	memset(cl, 0, sizeof(*cl));
>  	init_waitqueue_head(&cl->wait);
>  	init_waitqueue_head(&cl->rx_wait);
>  	init_waitqueue_head(&cl->tx_wait);
> @@ -575,7 +575,7 @@ struct mei_cl *mei_cl_allocate(struct mei_device *dev)
>  {
>  	struct mei_cl *cl;
>  
> -	cl = kmalloc(sizeof(struct mei_cl), GFP_KERNEL);
> +	cl = kmalloc(sizeof(*cl), GFP_KERNEL);
>  	if (!cl)
>  		return NULL;
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ