From patchwork Sun Feb 12 15:05:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 9568403 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 63AEC601C3 for ; Sun, 12 Feb 2017 15:05:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 533C4283AC for ; Sun, 12 Feb 2017 15:05:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46B88283E2; Sun, 12 Feb 2017 15:05:27 +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=-6.9 required=2.0 tests=BAYES_00,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 1D27A283AC for ; Sun, 12 Feb 2017 15:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751234AbdBLPFY (ORCPT ); Sun, 12 Feb 2017 10:05:24 -0500 Received: from www.osadl.org ([62.245.132.105]:38344 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbdBLPFX (ORCPT ); Sun, 12 Feb 2017 10:05:23 -0500 Received: from debian01.hofrr.at (92-243-34-74.adsl.nanet.at [92.243.34.74] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id v1CF4tfp007963; Sun, 12 Feb 2017 16:04:56 +0100 From: Nicholas Mc Guire To: Herbert Xu Cc: "David S. Miller" , Tadeusz Struk , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH RFC] crypto: testmgr drop wrong init_completion Date: Sun, 12 Feb 2017 16:05:46 +0100 Message-Id: <1486911946-19501-1-git-send-email-der.herr@hofr.at> X-Mailer: git-send-email 2.1.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 init_completion() is called here to reinitialize a completion object that was already re-initialized in wait_async_op() by reinit_completion() if complete (via tcrypt_complete()) had been called and wait_for_completion() returned, so no need to reinit it here. Fixes: commit 946cc46372dc ("crypto: testmgr - add tests vectors for RSA") Signed-off-by: Nicholas Mc Guire --- Found by experimental coccinelle script ./crypto/testmgr.c:2174:1-16: WARNING: possible duplicate init_completion Only based on code review and no testing. In case I am overlooking something and the re-initialization of the completion object is actually needed it should be using reinit_completion() and not init_completion() anyway. But as wait_async_op() will leave with the completion object re-initialized it really should not be needed here (found no path in between that could have called completion()). Patch was only compile tested with: x86_64_defconfig (implies cryptomgr-y) Patch is against linux-4.10-rc6 (localversion-next is next-20170210) crypto/testmgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 98eb097..15fb453 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2171,7 +2171,6 @@ static int test_akcipher_one(struct crypto_akcipher *tfm, sg_init_one(&src, xbuf[0], vecs->c_size); sg_init_one(&dst, outbuf_dec, out_len_max); - init_completion(&result.completion); akcipher_request_set_crypt(req, &src, &dst, vecs->c_size, out_len_max); /* Run RSA decrypt - m = c^d mod n;*/