All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: zero out mtd_partion struct before using it
Date: Thu, 12 Nov 2015 09:52:19 +0100	[thread overview]
Message-ID: <20151112095219.666e32c2@bbrezillon> (raw)
In-Reply-To: <1447289272-131828-1-git-send-email-computersforpeace@gmail.com>

On Wed, 11 Nov 2015 16:47:52 -0800
Brian Norris <computersforpeace@gmail.com> wrote:

> It's easier to guarantee we've cleared out all unused fields with
> memset() than by manually initializing each field.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
> I hit this while testing out the added 'of_node' field:
> 
>   http://patchwork.ozlabs.org/patch/538838/
> 
>  drivers/mtd/mtdpart.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index c2b6e967a160..3ace53342fd2 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -597,11 +597,10 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
>  	if (length <= 0)
>  		return -EINVAL;
>  
> +	memset(&part, 0, sizeof(part));
>  	part.name = name;
>  	part.size = length;
>  	part.offset = offset;
> -	part.mask_flags = 0;
> -	part.ecclayout = NULL;
>  
>  	new = allocate_partition(master, &part, -1, offset);
>  	if (IS_ERR(new))



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-11-12  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  0:47 [PATCH] mtd: zero out mtd_partion struct before using it Brian Norris
2015-11-12  8:52 ` Boris Brezillon [this message]
2015-11-12 18:13   ` Brian Norris

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=20151112095219.666e32c2@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.