From patchwork Sun Aug 9 15:21:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 256459 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B877DC433DF for ; Sun, 9 Aug 2020 15:21:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96EA3206B5 for ; Sun, 9 Aug 2020 15:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726200AbgHIPVu (ORCPT ); Sun, 9 Aug 2020 11:21:50 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:34067 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbgHIPVt (ORCPT ); Sun, 9 Aug 2020 11:21:49 -0400 X-IronPort-AV: E=Sophos;i="5.75,454,1589234400"; d="scan'208";a="462926077" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2020 17:21:37 +0200 Date: Sun, 9 Aug 2020 17:21:37 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Tomas Winkler cc: kbuild-all@lists.01.org, Zhou Furong , Alexander Usyskin , Ulf Hansson , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: block: fix memdup.cocci warnings Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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 subsystem") 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: 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);