From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 7E090CA9ECF for ; Fri, 1 Nov 2019 09:03:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18A8F2080F for ; Fri, 1 Nov 2019 09:03:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ilLIk9Wq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18A8F2080F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lip6.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KLlj86vJ0FTOnxXyHjP+XNPkEteAGGEqkFMNUNRYD2U=; b=ilLIk9WqvdzCxs Zm0rrIOLQTYlPyQHCpTy9REpYdob01tHxxdBdmS7AfM8toWv7t8oA2cX56euVQ802PYyaJp7JftJU vyrs4A3eCW0iEYjL8O/dKjzoJO3XGLGw1hGHeEq8qUUlfzl6c7upnjjGwsaIZu2Pc9Arrf0hWvJ2f q5d9pVBz3igPRsy1DHwFXotRWqE0KcNAUpI2eAd2IQ7wsgqMk51otXHqTIIKuXubhfAvlK1LXoPTs 2dPZv7ep5jeXcshOqcwn3c/4NCCqL1QMmuoVrOMZq7NrebfM+17TfaRV6qZtOwHXMjpsTc4zS0vAX vaAcxtohTcY6j3mwvHxQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQSpl-0007Yx-MK; Fri, 01 Nov 2019 09:03:05 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iQSpi-0007YL-I5 for linux-arm-kernel@lists.infradead.org; Fri, 01 Nov 2019 09:03:04 +0000 X-IronPort-AV: E=Sophos;i="5.68,254,1569276000"; d="scan'208";a="409892343" Received: from abo-45-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.45]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 09:55:35 +0100 Date: Fri, 1 Nov 2019 09:55:34 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Corentin Labbe Subject: [PATCH] crypto: fix memdup.cocci warnings Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191101_020302_866488_97AF3981 X-CRM114-Status: UNSURE ( 8.83 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kbuild-all@lists.01.org, Herbert Xu , linux-kernel@vger.kernel.org, Maxime Ripard , Chen-Yu Tsai , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: kbuild test robot Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci Fixes: f08fcced6d00 ("crypto: allwinner - Add sun8i-ss cryptographic offloader") CC: Corentin Labbe Signed-off-by: kbuild test robot Signed-off-by: Julia Lawall --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master head: 298b4c604008025b134bc6fccbc4018449945d60 commit: f08fcced6d0017c39cb6eccb571290867119d049 [154/163] crypto: allwinner - Add sun8i-ss cryptographic offloader :::::: branch date: 3 hours ago :::::: commit date: 3 hours ago Please take the patch only if it's a positive warning. Thanks! sun8i-ss-cipher.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c @@ -398,10 +398,9 @@ int sun8i_ss_aes_setkey(struct crypto_sk kfree(op->key); } op->keylen = keylen; - op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA); + op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); if (!op->key) return -ENOMEM; - memcpy(op->key, key, keylen); crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK); crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK); @@ -426,10 +425,9 @@ int sun8i_ss_des3_setkey(struct crypto_s kfree(op->key); } op->keylen = keylen; - op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA); + op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); if (!op->key) return -ENOMEM; - memcpy(op->key, key, keylen); crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK); crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel