linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: kbuild-all@lists.01.org, Zhou Furong <furong.zhou@intel.com>,
	Alexander Usyskin <alexander.usyskin@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mmc: block: fix memdup.cocci warnings
Date: Sun, 9 Aug 2020 17:21:37 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2008091720080.2450@hadrien> (raw)

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);


                 reply	other threads:[~2020-08-09 15:22 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.22.394.2008091720080.2450@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=alexander.usyskin@intel.com \
    --cc=furong.zhou@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    --cc=ulf.hansson@linaro.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 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).