linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: block: fix memdup.cocci warnings
@ 2020-08-09 15:21 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2020-08-09 15:21 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: kbuild-all, Zhou Furong, Alexander Usyskin, Ulf Hansson,
	linux-mmc, linux-kernel

From: kernel test robot <lkp@intel.com>

 Use kmemdup rather than duplicating its implementation

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

Fixes: 68083eebfb0a ("mmc: block: register RPMB partition with the RPMB subsystem")
CC: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://github.com/intel/linux-intel-lts.git 5.4/preempt-rt
head:   64f494c08613ebb24a83b69223e7f90e8b7ce956
commit: 68083eebfb0a008e9bec30cefb2260f0543ed5ec [97/9103] mmc: block: register RPMB partition with the RPMB subsystem
:::::: branch date: 4 days ago
:::::: commit date: 9 months ago

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

--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1270,11 +1270,10 @@ static int mmc_blk_rpmb_set_dev_id(struc
 {
 	char *id;

-	id = kmalloc(sizeof(card->raw_cid), GFP_KERNEL);
+	id = kmemdup(card->raw_cid, sizeof(card->raw_cid), GFP_KERNEL);
 	if (!id)
 		return -ENOMEM;

-	memcpy(id, card->raw_cid, sizeof(card->raw_cid));
 	ops->dev_id = id;
 	ops->dev_id_len = sizeof(card->raw_cid);


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

only message in thread, other threads:[~2020-08-09 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-09 15:21 [PATCH] mmc: block: 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).