Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp377504rwe; Thu, 25 Aug 2022 01:52:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Cis1ZcDrSkV9MCp/1FDqqbK+vGh9QiqNlQql5Gt2kA6IA6YkRJjI+dDE6drDhdTc4ryQb X-Received: by 2002:a17:903:2c9:b0:172:57d5:d6f0 with SMTP id s9-20020a17090302c900b0017257d5d6f0mr3025782plk.61.1661417519997; Thu, 25 Aug 2022 01:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661417519; cv=none; d=google.com; s=arc-20160816; b=u1HNSS+OoHtiCSEEzr/lgF9Sj8tubouZOrrm04B1v6Fz3O97N71DvZVcRTLCjDZ0NO oBhXsQrsc6FUADI5bWMRFkYqwd5fNFIC8L6v1QuqHuWA6oVuiwxlC3YsB8AtXJXDYSle MWVrN3ubk9TRMcOEUymA0whB5QjsGyhk9Na+bat8pdUraXJxbKHAwaLx1LEOKwDPorG+ Z9deL9dXq++08zE9y8a7T6n/BEB7UPHPeNo7xTz2GTUYO4WLS2v1r1fn5BzFSEoH7qk4 2w7o9kz7WD80XfYRH3a8V4IxxCMYkFv81/GJ+YDUXKmp2fBBpRG821ncWdDgjWX4l49w +2tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2Hn3p5WZzJKNfr50kY92pE4Z5B6m4J3rY5ggTwc6mv0=; b=01ugUPBfhrAPoYVjum3td8/NzMBu33uL3k9fPj0vj1kP3ZShaccM6LqJWl82IRRAJK Mx8dZ6RpA3GuN7OqM3nyrf52zBVfZmkVsG0EeDC22DIKQXpeeF5aTcGiR/dT7s091JA3 r8DOykKSJWVZ+zA6U+G1enayM9Pic+/mkVnMmqLIc41KDFqW3/yPwDT1BO51cVLm65ji ndDFUBDGMKm4ZMsx2dnRaP/oPiVQMfVy4WJkIsLJKn251bOqeX4cZtb46sW97n1U6dpW sDyDdqISuxAunRlCr5xCmods9vFRoxrZ7F/aAFoKWXH9CRP3+FFA99Dhfx9ussDW7v5n 6eBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j184-20020a638bc1000000b00429ead7ee92si17357537pge.785.2022.08.25.01.51.45; Thu, 25 Aug 2022 01:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233561AbiHYIuP (ORCPT + 99 others); Thu, 25 Aug 2022 04:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232805AbiHYIuO (ORCPT ); Thu, 25 Aug 2022 04:50:14 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DFD98F941; Thu, 25 Aug 2022 01:50:12 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oR8Yt-00Exl6-EM; Thu, 25 Aug 2022 18:50:04 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Thu, 25 Aug 2022 16:50:03 +0800 Date: Thu, 25 Aug 2022 16:50:03 +0800 From: Herbert Xu To: Gaosheng Cui Cc: davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next 1/2] crypto: api - Fix IS_ERR() vs NULL check Message-ID: References: <20220825084138.1881954-1-cuigaosheng1@huawei.com> <20220825084138.1881954-2-cuigaosheng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825084138.1881954-2-cuigaosheng1@huawei.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Aug 25, 2022 at 04:41:37PM +0800, Gaosheng Cui wrote: > The crypto_alloc_test_larval() will return null if manager is disabled, > it may not return error pointers, so using IS_ERR_OR_NULL() > to check the return value to fix this. > > The __crypto_register_alg() will return null if manager is disabled, > it may not return error pointers, so using IS_ERR_OR_NULL() > to check the return value to fix this. > > Fixes: cad439fc040e ("crypto: api - Do not create test larvals if manager is disabled") > Signed-off-by: Gaosheng Cui > --- > crypto/algapi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/crypto/algapi.c b/crypto/algapi.c > index 5c69ff8e8fa5..5a080b8aaa11 100644 > --- a/crypto/algapi.c > +++ b/crypto/algapi.c > @@ -283,7 +283,7 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg) > } > > larval = crypto_alloc_test_larval(alg); > - if (IS_ERR(larval)) > + if (IS_ERR_OR_NULL(larval)) > goto out; A NULL indicates success, why are you jumping to the error path? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt