lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 26 Aug 2016 23:19:39 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Stephen Rothwell <sfr@...b.auug.org.au>
Cc:     Martin Schwidefsky <schwidefsky@...ibm.com>,
        linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
        Linux Crypto Mailing List <linux-crypto@...r.kernel.org>
Subject: crypto: xor - Fix warning when XOR_SELECT_TEMPLATE is unset

On Thu, Aug 25, 2016 at 09:14:11PM +1000, Stephen Rothwell wrote:
>
> That looks fine to me.  An alternative might be to have:
> 
> #ifndef XOR_SELECT_TEMPLATE
> #define XOR_SELECT_TEMPLATE(x)	(x)
> #endif
> 
> near the top of the file.  That gets the #ifdef out of the code flow
> and serves as some hint that such a thing can be defined by arch header
> files.

Good idea.  Thanks Stephen.

---8<---
This patch fixes an unused label warning triggered when the macro
XOR_SELECT_TEMPLATE is not set.

Fixes: 39457acda913 ("crypto: xor - skip speed test if the xor...")
Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
Suggested-by: Stephen Rothwell <sfr@...b.auug.org.au>
Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>

diff --git a/crypto/xor.c b/crypto/xor.c
index b8975d9..263af9f 100644
--- a/crypto/xor.c
+++ b/crypto/xor.c
@@ -24,6 +24,10 @@
 #include <linux/preempt.h>
 #include <asm/xor.h>
 
+#ifndef XOR_SELECT_TEMPLATE
+#define XOR_SELECT_TEMPLATE(x) (x)
+#endif
+
 /* The xor routines to use.  */
 static struct xor_block_template *active_template;
 
@@ -109,17 +113,14 @@ calibrate_xor_blocks(void)
 	void *b1, *b2;
 	struct xor_block_template *f, *fastest;
 
-	fastest = NULL;
+	fastest = XOR_SELECT_TEMPLATE(NULL);
 
-#ifdef XOR_SELECT_TEMPLATE
-	fastest = XOR_SELECT_TEMPLATE(fastest);
 	if (fastest) {
 		printk(KERN_INFO "xor: automatically using best "
 				 "checksumming function   %-10s\n",
 		       fastest->name);
 		goto out;
 	}
-#endif
 
 	/*
 	 * Note: Since the memory is not actually used for _anything_ but to
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ