Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp600858rwe; Thu, 25 Aug 2022 06:11:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Hq2Y3k+QsyH0NaE0BJpkbWidpUaDhISlT36xcCnBKjH8IN/W8l48Rpek5vjg0CvvcT6E6 X-Received: by 2002:a05:6402:4cf:b0:446:42cf:e49d with SMTP id n15-20020a05640204cf00b0044642cfe49dmr3113217edw.41.1661433108864; Thu, 25 Aug 2022 06:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661433108; cv=none; d=google.com; s=arc-20160816; b=WDAWk4EDddVZsJpkQPRj7wug0kD71kDc6O3mw5saPKMa2HwGkeqQlhRvCyXbQkIHxW 1KEdv3BO5/Rks1Jkn2sqSXpg4oWUjxQecmPy0ZAMCC7eImfs4eHXWEO0cXsTxNd/MiMh qBGJ3CGmfPZYi5VsKnZHlH9pZVvD6TIG99svMLi7kYcqEPopBS58bZM0mZbC+bpJXs77 JjRe8WR5I5zPNU+3ldviXu1AJcmkeMWkPXHs+2IL/2tbHoUTMUQQBPOCXbeTO2w4zsCQ +GWGkZjylti1BWCEi3p858iH1WdTv6E699RyncL5qCWvm6luO1VyawjUOVBoTvidZwJS VoFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=vfRShMnXB99+EMM7itbCLc6yx78x1du28U9teTvzi3w=; b=FgGeKzKNmINCiKJP74PhfEyxr5mJO/rg3gSDwL4yGR13jDsEagZ9BresgjWVA/h4m5 b32Nwwl9MlzydZ6lSlc17Trbhe0EwQXY29cj8kIGWoDjnhuEe5uuOVpXYmw9ZH0N1pZf /jzikib1K0DoUe66B1W8wuVPtMd5Rjm6q8Evy9h9O5lqdClxqI/rI3X0TnCMFaoTQVWH mamn7bqeMHd/onGPpEyPbsxhGwCYICbNRrIJMVFpBYYJDBe91SXtqHva7xWBddj5v5Lo 4JvvNYpXKnf5B9eZi2BR8z+UWWHAph3GpFDTpuA9gHKFeq+nB1jF1/5nEuZn3r9PUD1B V/Dw== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj7-20020a0564022b8700b004478be1775esi2622166edb.341.2022.08.25.06.11.16; Thu, 25 Aug 2022 06:11:48 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242397AbiHYNKz (ORCPT + 99 others); Thu, 25 Aug 2022 09:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242093AbiHYNKx (ORCPT ); Thu, 25 Aug 2022 09:10:53 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF83A50EB; Thu, 25 Aug 2022 06:10:52 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MD3Ds583CznTXf; Thu, 25 Aug 2022 21:08:29 +0800 (CST) Received: from [10.67.110.176] (10.67.110.176) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 25 Aug 2022 21:10:49 +0800 Subject: Re: [PATCH -next 1/2] crypto: api - Fix IS_ERR() vs NULL check To: Herbert Xu CC: , , References: <20220825084138.1881954-1-cuigaosheng1@huawei.com> <20220825084138.1881954-2-cuigaosheng1@huawei.com> From: cuigaosheng Message-ID: <0ae57826-6a8c-b08b-2889-f91d50bf6e59@huawei.com> Date: Thu, 25 Aug 2022 21:10:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.176] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Thanks for taking the time to review this patch. crypto_alloc_test_larval() will return null if manager is disabled, it will not return error pointers, IS_ERR should not be used to checking return value, should we fix it? or use another solution? It would be helpful if you could give some advice or fix the problem by yourself. Thanks very much! ?? 2022/8/25 16:50, Herbert Xu ะด??: > 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,