Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5371326rwl; Wed, 28 Dec 2022 18:09:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+5E7lv0bsjIDqgxoE3dK3FfGY4u2NA9bryln40IQDjYn3FKkN+TMHWGXypHiwrvq7kiNa X-Received: by 2002:a17:90a:db4f:b0:223:2aa8:7ae4 with SMTP id u15-20020a17090adb4f00b002232aa87ae4mr35065063pjx.47.1672279758340; Wed, 28 Dec 2022 18:09:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672279758; cv=none; d=google.com; s=arc-20160816; b=zFpZAdBfmMvUdOD2ztdsyZ1bx9vFTPZZoT08Qq04pOyp/QjSyV5MRecxCGgF3hs4FU hED4/nBb0jFFEi7nRyJh76LI9J/aCXQLGmKqzimuWQfJb5JI51dczQATu0BFk5g7l3H/ oE7WKgoGF/z0H3N1VffdNmKDZqrZNHyKncYrxWWaPY5VvwFWqoSjgw51ASOu3rGBGJ3E PBbTphYzmtHVQ1IbC+4FCUeYMmN/sYVM2WL7/t7vWe8qB6Y95DyYpXV7JN8qapj2Tl1Y OcNJDXsLHbD2+IWpb+EewqgnfHoKceR3pmqkSI6kXmxGwZiPuj5KBNX4Tga+63iiXWmO YO3w== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FdVhPL7qSdPkN3r3BvnOseBQ7bWp4W2z9gkf2fq52Ic=; b=F6VlxJbg/cbV8VK3IICuUdOUIlV8Urh2Y7iT+oAyRRBTnh29RqIQqEEqE1yRTn1RBN zDfL9CRmjLcFjBrmvCPxSfRPJ3tyypR8bsSWKfNN1tDIzy2CWTXQwmYy0CLDzk0p6hpT 7/Ms5GxZSwQadnF+Ni8fsje1DLhUV4qVgrXU8Q0OtvULzF27mCf9+h9J2y43+93xKioY lo7EsEHHHQxggA6kXNoWvpzlOTj9ZIqMu4IL6fTxwkdnfG0NXC7qEsaJ9u/wshV6p/3z TWVkqFkwyV7ZKvw0wV5daMprs1h23jbvwBbr2JTCxo7UyR3Iioi1efGQ0iQOlExf67+C yDAg== 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 lx6-20020a17090b4b0600b00223ea01e3fbsi681101pjb.60.2022.12.28.18.08.55; Wed, 28 Dec 2022 18:09:18 -0800 (PST) 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 S230435AbiL2Bsv (ORCPT + 99 others); Wed, 28 Dec 2022 20:48:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230106AbiL2Bsv (ORCPT ); Wed, 28 Dec 2022 20:48:51 -0500 Received: from formenos.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5666E12604; Wed, 28 Dec 2022 17:48:48 -0800 (PST) Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1pAi28-00BrPk-4O; Thu, 29 Dec 2022 09:48:37 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Thu, 29 Dec 2022 09:48:36 +0800 Date: Thu, 29 Dec 2022 09:48:36 +0800 From: Herbert Xu To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Anders Roxell , Kees Cook , Horia =?utf-8?Q?Geant=C4=83?= , Gaurav Jain , Pankaj Gupta , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-crypto@vger.kernel.org, kernel@pengutronix.de, "David S. Miller" , kernel test robot Subject: Re: [PATCH] crypto: caam - Avoid GCC memset bug warning Message-ID: References: <20221222162513.4021928-1-u.kleine-koenig@pengutronix.de> <20221223174719.4n6pmwio4zycj2qm@pengutronix.de> <20221228113035.ups6echnsmo4flnz@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221228113035.ups6echnsmo4flnz@pengutronix.de> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 Wed, Dec 28, 2022 at 12:30:35PM +0100, Uwe Kleine-K?nig wrote: > > > - if (len) /* avoid sparse warning: memcpy with byte count of 0 */ > > + /* Avoid gcc warning: memcpy with data == NULL */ > > + if (!IS_ENABLED(CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG) || data) > > I just tried: For me a plain > > if (data) > > is also enough to make both gcc and sparse happy. Of course it is. The point of the extra condition is to remove the unnecessary check on data unless we are in debugging mode (as it is only needed in debugging mode to work around the buggy compiler). > (On a related note, sparse reports: > > CHECK drivers/crypto/caam/jr.c > drivers/crypto/caam/jr.c: note: in included file (through arch/arm64/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...): > include/asm-generic/io.h:290:22: warning: incorrect type in argument 1 (different base types) > include/asm-generic/io.h:290:22: expected unsigned long long [usertype] val > include/asm-generic/io.h:290:22: got restricted __le64 [usertype] > include/asm-generic/io.h:290:22: warning: incorrect type in argument 1 (different base types) > include/asm-generic/io.h:290:22: expected unsigned long long [usertype] val > include/asm-generic/io.h:290:22: got restricted __le64 [usertype] That's a bug in include/asm-generic/io.h. It feeds an __le64 to __raw_writeq which wants a u64. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt