From patchwork Mon Apr 16 14:05:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10343021 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 78DBC601D7 for ; Mon, 16 Apr 2018 14:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A0A028761 for ; Mon, 16 Apr 2018 14:08:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5EB6A2878C; Mon, 16 Apr 2018 14:08:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46FF128761 for ; Mon, 16 Apr 2018 14:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751110AbeDPOIS (ORCPT ); Mon, 16 Apr 2018 10:08:18 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:39782 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbeDPOIS (ORCPT ); Mon, 16 Apr 2018 10:08:18 -0400 Received: by mail-qt0-f193.google.com with SMTP id l8so11578740qtp.6 for ; Mon, 16 Apr 2018 07:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=84Mp9Sx2gBg+YCjwCmNiwfyHcEjf5x5WxfSENJvEG6U=; b=Vug1BDDTT0Pxc7yANG9VrXB81AtWVo8B5wM3T2uVckLIbWA+YehoMh1/GWplq0J3PR acAkuzxPpUxLQKPWgXzwJ4slAwqrNaVMpBIQzlJnoftTwnwLi2XbLjCng+ls2O+b63KJ tb6KUZi8CUVyoEoGtVjM57orGnK2SJF+tXnqci8GZcKSP7tdsuQs2LXH94PkLDHo66sa 816CX3MpNRw7Ey4zzdClbRzM118yoWt3X90UXuVhQh6QC/31yabVPl/FQtgIb7DCzl0a JOWQ0RJW5p4BfUd50EQqABSVEee2WwrBLJbxYDel1jNO24kQMjBgq6YRQiJrFDe+YFOj tqCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=84Mp9Sx2gBg+YCjwCmNiwfyHcEjf5x5WxfSENJvEG6U=; b=f76qlDrWjnnTrxBcTsDha8sZbDg74SySDti/1H5154NNNEU+qZB5kx6BECVdJDwgz0 jA2gF0kSuicCZNPX3/NP97uTOuP1JEI9LB2YBqYG1aM0sAaNvxJlSVzsmqoMrvzl7q2P OMoOjxyMA9yA+PfNGQkqzzS+j15/pEL4rUxB6mcQrt3oT7kea2q/4WNokfnUmVzmEPWq wrdpGK8XA3sFrh4F7A1rsXAUmPPNQ2+CMgDWpMBRlGY0cy88S+ljqimkmg+zatCxzVkN mq3h1rpdEOf5UwnvHbtiZhqmUjCX84evY89McFOiHMnPi/J136m4IJXpzcs6ybb1sj03 +rxA== X-Gm-Message-State: ALQs6tBYKIuyW4SbUT7R3uoRQbifsA0ySmNKuaA2jDgRJxVNYzsdErZ9 J5trFSrENF3BP3ZB9DogFvs= X-Google-Smtp-Source: AIpwx49dOd37fUSuPDUXGwB3twSLiFsFthch+jvubq8DIv7UC97MNf5QEWSr7ZEaxOdr/VY4FsgsRQ== X-Received: by 10.200.25.170 with SMTP id u39mr12970179qtj.221.1523887697347; Mon, 16 Apr 2018 07:08:17 -0700 (PDT) Received: from localhost.localdomain ([187.180.183.211]) by smtp.gmail.com with ESMTPSA id t69sm9370191qka.9.2018.04.16.07.08.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 07:08:16 -0700 (PDT) From: Fabio Estevam To: herbert@gondor.apana.org.au Cc: horia.geanta@nxp.com, aymen.sghaier@nxp.com, linux-crypto@vger.kernel.org, Fabio Estevam Subject: [PATCH] crypto: caam: - Use kmemdup() function Date: Mon, 16 Apr 2018 11:05:14 -0300 Message-Id: <1523887514-17444-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Use kmemdup() rather than duplicating its implementation. Detected with Coccinelle script. Signed-off-by: Fabio Estevam --- drivers/crypto/caam/caampkc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c index 979072b..c3518ce 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -789,12 +789,10 @@ static inline u8 *caam_read_raw_data(const u8 *buf, size_t *nbytes) if (!*nbytes) return NULL; - val = kzalloc(*nbytes, GFP_DMA | GFP_KERNEL); + val = kmemdup(buf, *nbytes, GFP_DMA | GFP_KERNEL); if (!val) return NULL; - memcpy(val, buf, *nbytes); - return val; }