Content-Type: multipart/mixed; boundary="===============1310587597919645241==" MIME-Version: 1.0 From: Julia Lawall To: kbuild-all@lists.01.org Subject: [PATCH] mmc: block: fix memdup.cocci warnings Date: Sun, 09 Aug 2020 17:21:37 +0200 Message-ID: List-Id: --===============1310587597919645241== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: kernel test robot Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci Fixes: 68083eebfb0a ("mmc: block: register RPMB partition with the RPMB sub= system") CC: Tomas Winkler Signed-off-by: kernel test robot Signed-off-by: Julia Lawall --- tree: https://github.com/intel/linux-intel-lts.git 5.4/preempt-rt head: 64f494c08613ebb24a83b69223e7f90e8b7ce956 commit: 68083eebfb0a008e9bec30cefb2260f0543ed5ec [97/9103] mmc: block: regi= ster 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 =3D kmalloc(sizeof(card->raw_cid), GFP_KERNEL); + id =3D 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 =3D id; ops->dev_id_len =3D sizeof(card->raw_cid); --===============1310587597919645241==--