]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 May 2020 08:02:01 +0000 (10:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 May 2020 08:02:01 +0000 (10:02 +0200)
added patches:
gcc-10-avoid-shadowing-standard-library-free-in-crypto.patch

queue-4.9/gcc-10-avoid-shadowing-standard-library-free-in-crypto.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/gcc-10-avoid-shadowing-standard-library-free-in-crypto.patch b/queue-4.9/gcc-10-avoid-shadowing-standard-library-free-in-crypto.patch
new file mode 100644 (file)
index 0000000..ecda96c
--- /dev/null
@@ -0,0 +1,87 @@
+From 1a263ae60b04de959d9ce9caea4889385eefcc7b Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sat, 9 May 2020 15:58:04 -0700
+Subject: gcc-10: avoid shadowing standard library 'free()' in crypto
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 1a263ae60b04de959d9ce9caea4889385eefcc7b upstream.
+
+gcc-10 has started warning about conflicting types for a few new
+built-in functions, particularly 'free()'.
+
+This results in warnings like:
+
+   crypto/xts.c:325:13: warning: conflicting types for built-in function ‘free’; expected ‘void(void *)’ [-Wbuiltin-declaration-mismatch]
+
+because the crypto layer had its local freeing functions called
+'free()'.
+
+Gcc-10 is in the wrong here, since that function is marked 'static', and
+thus there is no chance of confusion with any standard library function
+namespace.
+
+But the simplest thing to do is to just use a different name here, and
+avoid this gcc mis-feature.
+
+[ Side note: gcc knowing about 'free()' is in itself not the
+  mis-feature: the semantics of 'free()' are special enough that a
+  compiler can validly do special things when seeing it.
+
+  So the mis-feature here is that gcc thinks that 'free()' is some
+  restricted name, and you can't shadow it as a local static function.
+
+  Making the special 'free()' semantics be a function attribute rather
+  than tied to the name would be the much better model ]
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ crypto/lrw.c |    4 ++--
+ crypto/xts.c |    4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/crypto/lrw.c
++++ b/crypto/lrw.c
+@@ -377,7 +377,7 @@ out_put_alg:
+       return inst;
+ }
+-static void free(struct crypto_instance *inst)
++static void free_inst(struct crypto_instance *inst)
+ {
+       crypto_drop_spawn(crypto_instance_ctx(inst));
+       kfree(inst);
+@@ -386,7 +386,7 @@ static void free(struct crypto_instance
+ static struct crypto_template crypto_tmpl = {
+       .name = "lrw",
+       .alloc = alloc,
+-      .free = free,
++      .free = free_inst,
+       .module = THIS_MODULE,
+ };
+--- a/crypto/xts.c
++++ b/crypto/xts.c
+@@ -329,7 +329,7 @@ out_put_alg:
+       return inst;
+ }
+-static void free(struct crypto_instance *inst)
++static void free_inst(struct crypto_instance *inst)
+ {
+       crypto_drop_spawn(crypto_instance_ctx(inst));
+       kfree(inst);
+@@ -338,7 +338,7 @@ static void free(struct crypto_instance
+ static struct crypto_template crypto_tmpl = {
+       .name = "xts",
+       .alloc = alloc,
+-      .free = free,
++      .free = free_inst,
+       .module = THIS_MODULE,
+ };
index b4cc7d65251aa4076aaebfecb211e20a3e93d1a4..43afc298cdf95ca92900117fb3d012b3d0a3b3de 100644 (file)
@@ -60,6 +60,7 @@ gcc-10-warnings-fix-low-hanging-fruit.patch
 kbuild-compute-false-positive-wmaybe-uninitialized-cases-in-kconfig.patch
 stop-the-ad-hoc-games-with-wno-maybe-initialized.patch
 net-phy-micrel-use-strlcpy-for-ethtool-get_strings.patch
+gcc-10-avoid-shadowing-standard-library-free-in-crypto.patch
 gcc-10-disable-zero-length-bounds-warning-for-now.patch
 gcc-10-disable-array-bounds-warning-for-now.patch
 gcc-10-disable-stringop-overflow-warning-for-now.patch