lkml.org 
[lkml]   [2018]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mtd: rawnand: fix memdup.cocci warnings
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;
\
 
 \ /
  Last update: 2018-03-02 21:01    [W:0.049 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site