Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1763854rwe; Fri, 2 Sep 2022 03:31:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Y5JviYKDuRQ/1tbDvbCy29hczAWOh54wzBhEZx8n3S9+fVG3wOkbRt8mXxc6JlcwXQX4G X-Received: by 2002:a17:907:7dac:b0:739:8df9:3c16 with SMTP id oz44-20020a1709077dac00b007398df93c16mr26494225ejc.9.1662114711334; Fri, 02 Sep 2022 03:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662114711; cv=none; d=google.com; s=arc-20160816; b=jdTaG2XezsorRieRZMu70rZGclHsnp8WsEW//LQTLDyKjOa5zKdyDdpHr4Vho6dwl0 aL5qeIL3j3ou1aCm5tzgGe1vogbDWRDMrSGdQ0xUqCK4G5vGAAgg8hKenEDdI9EoBZmv 6FQLOMUgOq5K7T02je6bXPQjyPuYcQm8VwM+vKlZFSbvt4rcHpGbPVSY0FygLiZ1tmnU EXutZktv8CUnAf/Ho/oLal+3FGa5sfJPef3PfO6FS7VWGevXFVDpYw4qZadH3AT+gM66 wGU38Gpurl78ES9CTX8tSdxbpigYOWwgLsCEOe7b8Axj4cDJn6/LU5n9BebYDgPNKu9J EeTA== 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=A6OFme4VwMk+2OiyL08tidg4tP0fO8DtpN0xAJatQ70=; b=bPKzcLWSCK5H5nIVEZd9gt6BqQAUOSxsb52NffL1haqNZFYIH3qX8NGlFIIDZj8W9S mpynrh13UTGu2oZXE3jlQByT5dlLoOm3s44RKh1+vG5RewAQUxXwF/yK7EXQoo3Vuk1m DfTbeaLlgrMWjdWP7ohev5usQ7ZPb2keExxiTzrqW50CXbpz5xBJrOvwMiiOpFoBgx6W zzMiba38XC9V8R8UScnoz/aypiOIzlTuuUtO5lEyeExY99paVB4Sb8lOnYYOfqfPjoma v74ynd82QmFIaay2gN+yeOx6ssXnzpU8siZp6CqEnh4JtnmLCtdClldiDSwUhNUyZOEP L+Mg== 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 jg11-20020a170907970b00b0073d6430df46si1801138ejc.974.2022.09.02.03.31.25; Fri, 02 Sep 2022 03:31:51 -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 S231310AbiIBKOn (ORCPT + 99 others); Fri, 2 Sep 2022 06:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232619AbiIBKOT (ORCPT ); Fri, 2 Sep 2022 06:14:19 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36633C1A; Fri, 2 Sep 2022 03:14:17 -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 1oU3gT-000KYi-9s; Fri, 02 Sep 2022 20:13:58 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 02 Sep 2022 18:13:57 +0800 Date: Fri, 2 Sep 2022 18:13:57 +0800 From: Herbert Xu To: Jack Wang Cc: linux-crypto@vger.kernel.org, Corentin Labbe , Hans Ulli Kroll , Linus Walleij , "David S. Miller" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] crypto: gemin: Fix error check for dma_map_sg Message-ID: References: <20220825072421.29020-1-jinpu.wang@ionos.com> <20220825072421.29020-2-jinpu.wang@ionos.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220825072421.29020-2-jinpu.wang@ionos.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 On Thu, Aug 25, 2022 at 09:24:16AM +0200, Jack Wang wrote: > dma_map_sg return 0 on error. > > Cc: Corentin Labbe > Cc: Hans Ulli Kroll > Cc: Linus Walleij > Cc: Herbert Xu > Cc: "David S. Miller" > Cc: linux-crypto@vger.kernel.org > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Fixes: 46c5338db7bd ("crypto: sl3516 - Add sl3516 crypto engine") > Signed-off-by: Jack Wang > --- > drivers/crypto/gemini/sl3516-ce-cipher.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/crypto/gemini/sl3516-ce-cipher.c b/drivers/crypto/gemini/sl3516-ce-cipher.c > index 14d0d83d388d..34fea8aa91b6 100644 > --- a/drivers/crypto/gemini/sl3516-ce-cipher.c > +++ b/drivers/crypto/gemini/sl3516-ce-cipher.c > @@ -149,7 +149,7 @@ static int sl3516_ce_cipher(struct skcipher_request *areq) > if (areq->src == areq->dst) { > nr_sgs = dma_map_sg(ce->dev, areq->src, sg_nents(areq->src), > DMA_BIDIRECTIONAL); > - if (nr_sgs <= 0 || nr_sgs > MAXDESC / 2) { > + if (!nr_sgs || nr_sgs > MAXDESC / 2) { > dev_err(ce->dev, "Invalid sg number %d\n", nr_sgs); > err = -EINVAL; > goto theend; The original code is correct and this patch is arguably making it less robust. So I'll drop this particular patch. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt