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>] [day] [month] [year] [list]
Date:   Mon, 16 Jul 2018 13:31:15 -0700
From:   Davidlohr Bueso <dave@...olabs.net>
To:     herbert@...dor.apana.org.au
Cc:     linux-kernel@...r.kernel.org, dave@...olabs.net,
        Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH] lib/crc10dif: Update crct10dif_fallback static key to modern api

No changes in semantics -- key init is false; replace

static_key_slow_inc       with   static_branch_inc
static_key_false          with   static_branch_unlikely

Added a '_key' suffix to crc10dif_fallback for better self
documentation.

Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
 lib/crc-t10dif.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
index 1ad33e555805..528b24249ddd 100644
--- a/lib/crc-t10dif.c
+++ b/lib/crc-t10dif.c
@@ -17,7 +17,7 @@
 #include <linux/static_key.h>
 
 static struct crypto_shash *crct10dif_tfm;
-static struct static_key crct10dif_fallback __read_mostly;
+static DEFINE_STATIC_KEY_FALSE(crct10dif_fallback_key);
 
 __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
 {
@@ -27,7 +27,7 @@ __u16 crc_t10dif_update(__u16 crc, const unsigned char *buffer, size_t len)
 	} desc;
 	int err;
 
-	if (static_key_false(&crct10dif_fallback))
+	if (static_branch_unlikely(&crct10dif_fallback_key))
 		return crc_t10dif_generic(crc, buffer, len);
 
 	desc.shash.tfm = crct10dif_tfm;
@@ -51,7 +51,7 @@ static int __init crc_t10dif_mod_init(void)
 {
 	crct10dif_tfm = crypto_alloc_shash("crct10dif", 0, 0);
 	if (IS_ERR(crct10dif_tfm)) {
-		static_key_slow_inc(&crct10dif_fallback);
+		static_branch_inc(&crct10dif_fallback_key);
 		crct10dif_tfm = NULL;
 	}
 	return 0;
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ