Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	kbuild-all@01.org
Subject: [PATCH] mtd: rawnand: fix memdup.cocci warnings
Date: Fri, 2 Mar 2018 21:00:39 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1803022058240.3114@hadrien> (raw)

From: Fengguang Wu <fengguang.wu@intel.com>

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-buy: Julia Lawall <julia.lawall@lip6.fr>
---

tree:   https://github.com/bbrezillon/linux-0day mraynal/nand-scan
head:   0fdb0ec57e123aae03d1c52f8ba5fb6c8c8f98ed
commit: d4d20cd03273ee0d1bb874dc33170286216b6320 [70/71] mtd: rawnand: do
not export nand_scan_[ident|tail]() anymore

 nand_base.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5160,13 +5160,12 @@ static int nand_flash_detect_onfi(struct

 	sanitize_string(p->manufacturer, sizeof(p->manufacturer));
 	sanitize_string(p->model, sizeof(p->model));
-	model = kzalloc(sizeof(p->model), GFP_KERNEL);
+	model = kmemdup(p->model, sizeof(p->model), GFP_KERNEL);
 	if (!model) {
 		ret = -ENOMEM;
 		goto free_onfi_param_page;
 	}

-	memcpy(model, p->model, sizeof(p->model));
 	chip->parameters.model = model;
 	if (!mtd->name)
 		mtd->name = chip->parameters.model;

                 reply	other threads:[~2018-03-02 20:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.20.1803022058240.3114@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=yamada.masahiro@socionext.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