mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Tomas Winkler <tomas.winkler@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Usyskin <alexander.usyskin@intel.com>,
	linux-kernel@vger.kernel.org,
	"Gustavo A . R . Silva" <gustavoars@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [char-misc-next 4/6] mei: client: use sizeof of variable instead of struct type
Date: Thu, 23 Jul 2020 11:54:24 -0500	[thread overview]
Message-ID: <67c7aeea-cfe6-a98b-bbe1-4881d8dc5ae0@embeddedor.com> (raw)
In-Reply-To: <20200723145927.882743-5-tomas.winkler@intel.com>



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@kernel.org>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.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;
>  
> 

  reply	other threads:[~2020-07-23 16:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 14:59 [char-misc-next 0/6] mei: remove one-element arrays Tomas Winkler
2020-07-23 14:59 ` [char-misc-next 1/6] mei: hbm: use sizeof of variable instead of struct type Tomas Winkler
2020-07-23 15:13   ` Greg Kroah-Hartman
2020-07-23 17:04     ` Gustavo A. R. Silva
2020-07-23 17:29       ` Greg Kroah-Hartman
2020-07-23 17:01   ` Gustavo A. R. Silva
2020-07-23 14:59 ` [char-misc-next 2/6] mei: ioctl: " Tomas Winkler
2020-07-23 16:55   ` Gustavo A. R. Silva
2020-07-23 14:59 ` [char-misc-next 3/6] mei: bus: " Tomas Winkler
2020-07-23 16:55   ` Gustavo A. R. Silva
2020-07-23 14:59 ` [char-misc-next 4/6] mei: client: " Tomas Winkler
2020-07-23 16:54   ` Gustavo A. R. Silva [this message]
2020-07-23 14:59 ` [char-misc-next 5/6] mei: hw: " Tomas Winkler
2020-07-23 16:53   ` Gustavo A. R. Silva
2020-07-23 14:59 ` [char-misc-next 6/6] mei: hw: don't use one element arrays Tomas Winkler
2020-07-23 16:49   ` Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67c7aeea-cfe6-a98b-bbe1-4881d8dc5ae0@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=alexander.usyskin@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome