linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: fix memdup.cocci warnings
@ 2018-03-02 20:00 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2018-03-02 20:00 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Boris Brezillon, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Cyrille Pitchen, Masahiro Yamada,
	linux-kernel, linux-mtd, kbuild-all

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-02 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-02 20:00 [PATCH] mtd: rawnand: fix memdup.cocci warnings Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).