--- /dev/null
+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
+@@ -531,7 +531,7 @@ static void exit_tfm(struct crypto_skcip
+ crypto_free_skcipher(ctx->child);
+ }
+
+-static void free(struct skcipher_instance *inst)
++static void free_inst(struct skcipher_instance *inst)
+ {
+ crypto_drop_skcipher(skcipher_instance_ctx(inst));
+ kfree(inst);
+@@ -642,7 +642,7 @@ static int create(struct crypto_template
+ inst->alg.encrypt = encrypt;
+ inst->alg.decrypt = decrypt;
+
+- inst->free = free;
++ inst->free = free_inst;
+
+ err = skcipher_register_instance(tmpl, inst);
+ if (err)
+--- a/crypto/xts.c
++++ b/crypto/xts.c
+@@ -469,7 +469,7 @@ static void exit_tfm(struct crypto_skcip
+ crypto_free_cipher(ctx->tweak);
+ }
+
+-static void free(struct skcipher_instance *inst)
++static void free_inst(struct skcipher_instance *inst)
+ {
+ crypto_drop_skcipher(skcipher_instance_ctx(inst));
+ kfree(inst);
+@@ -580,7 +580,7 @@ static int create(struct crypto_template
+ inst->alg.encrypt = encrypt;
+ inst->alg.decrypt = decrypt;
+
+- inst->free = free;
++ inst->free = free_inst;
+
+ err = skcipher_register_instance(tmpl, inst);
+ if (err)
--- /dev/null
+From 44720996e2d79e47d508b0abe99b931a726a3197 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sat, 9 May 2020 14:52:44 -0700
+Subject: gcc-10: disable 'array-bounds' warning for now
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 44720996e2d79e47d508b0abe99b931a726a3197 upstream.
+
+This is another fine warning, related to the 'zero-length-bounds' one,
+but hitting the same historical code in the kernel.
+
+Because C didn't historically support flexible array members, we have
+code that instead uses a one-sized array, the same way we have cases of
+zero-sized arrays.
+
+The one-sized arrays come from either not wanting to use the gcc
+zero-sized array extension, or from a slight convenience-feature, where
+particularly for strings, the size of the structure now includes the
+allocation for the final NUL character.
+
+So with a "char name[1];" at the end of a structure, you can do things
+like
+
+ v = my_malloc(sizeof(struct vendor) + strlen(name));
+
+and avoid the "+1" for the terminator.
+
+Yes, the modern way to do that is with a flexible array, and using
+'offsetof()' instead of 'sizeof()', and adding the "+1" by hand. That
+also technically gets the size "more correct" in that it avoids any
+alignment (and thus padding) issues, but this is another long-term
+cleanup thing that will not happen for 5.7.
+
+So disable the warning for now, even though it's potentially quite
+useful. Having a slew of warnings that then hide more urgent new issues
+is not an improvement.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -802,6 +802,7 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+
+ # We'll want to enable this eventually, but it's not going away for 5.7 at least
+ KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
++KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
+
+ # Enabled with W=2, disabled by default as noisy
+ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
--- /dev/null
+From adc71920969870dfa54e8f40dac8616284832d02 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sat, 9 May 2020 15:45:21 -0700
+Subject: gcc-10: disable 'restrict' warning for now
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit adc71920969870dfa54e8f40dac8616284832d02 upstream.
+
+gcc-10 now warns about passing aliasing pointers to functions that take
+restricted pointers.
+
+That's actually a great warning, and if we ever start using 'restrict'
+in the kernel, it might be quite useful. But right now we don't, and it
+turns out that the only thing this warns about is an idiom where we have
+declared a few functions to be "printf-like" (which seems to make gcc
+pick up the restricted pointer thing), and then we print to the same
+buffer that we also use as an input.
+
+And people do that as an odd concatenation pattern, with code like this:
+
+ #define sysfs_show_gen_prop(buffer, fmt, ...) \
+ snprintf(buffer, PAGE_SIZE, "%s"fmt, buffer, __VA_ARGS__)
+
+where we have 'buffer' as both the destination of the final result, and
+as the initial argument.
+
+Yes, it's a bit questionable. And outside of the kernel, people do have
+standard declarations like
+
+ int snprintf( char *restrict buffer, size_t bufsz,
+ const char *restrict format, ... );
+
+where that output buffer is marked as a restrict pointer that cannot
+alias with any other arguments.
+
+But in the context of the kernel, that 'use snprintf() to concatenate to
+the end result' does work, and the pattern shows up in multiple places.
+And we have not marked our own version of snprintf() as taking restrict
+pointers, so the warning is incorrect for now, and gcc picks it up on
+its own.
+
+If we do start using 'restrict' in the kernel (and it might be a good
+idea if people find places where it matters), we'll need to figure out
+how to avoid this issue for snprintf and friends. But in the meantime,
+this warning is not useful.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -805,6 +805,9 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+ KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
+
++# Another good warning that we'll want to enable eventually
++KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
++
+ # Enabled with W=2, disabled by default as noisy
+ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
+
--- /dev/null
+From 5a76021c2eff7fcf2f0918a08fd8a37ce7922921 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sat, 9 May 2020 15:40:52 -0700
+Subject: gcc-10: disable 'stringop-overflow' warning for now
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 5a76021c2eff7fcf2f0918a08fd8a37ce7922921 upstream.
+
+This is the final array bounds warning removal for gcc-10 for now.
+
+Again, the warning is good, and we should re-enable all these warnings
+when we have converted all the legacy array declaration cases to
+flexible arrays. But in the meantime, it's just noise.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -803,6 +803,7 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+ # We'll want to enable this eventually, but it's not going away for 5.7 at least
+ KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
+ KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds)
++KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
+
+ # Enabled with W=2, disabled by default as noisy
+ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
--- /dev/null
+From 5c45de21a2223fe46cf9488c99a7fbcf01527670 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sat, 9 May 2020 14:30:29 -0700
+Subject: gcc-10: disable 'zero-length-bounds' warning for now
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 5c45de21a2223fe46cf9488c99a7fbcf01527670 upstream.
+
+This is a fine warning, but we still have a number of zero-length arrays
+in the kernel that come from the traditional gcc extension. Yes, they
+are getting converted to flexible arrays, but in the meantime the gcc-10
+warning about zero-length bounds is very verbose, and is hiding other
+issues.
+
+I missed one actual build failure because it was hidden among hundreds
+of lines of warning. Thankfully I caught it on the second go before
+pushing things out, but it convinced me that I really need to disable
+the new warnings for now.
+
+We'll hopefully be all done with our conversion to flexible arrays in
+the not too distant future, and we can then re-enable this warning.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -800,6 +800,9 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+ # disable stringop warnings in gcc 8+
+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
+
++# We'll want to enable this eventually, but it's not going away for 5.7 at least
++KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
++
+ # Enabled with W=2, disabled by default as noisy
+ KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
+
--- /dev/null
+From 9d82973e032e246ff5663c9805fbb5407ae932e3 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Mon, 4 May 2020 09:16:37 -0700
+Subject: gcc-10 warnings: fix low-hanging fruit
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 9d82973e032e246ff5663c9805fbb5407ae932e3 upstream.
+
+Due to a bug-report that was compiler-dependent, I updated one of my
+machines to gcc-10. That shows a lot of new warnings. Happily they
+seem to be mostly the valid kind, but it's going to cause a round of
+churn for getting rid of them..
+
+This is the really low-hanging fruit of removing a couple of zero-sized
+arrays in some core code. We have had a round of these patches before,
+and we'll have many more coming, and there is nothing special about
+these except that they were particularly trivial, and triggered more
+warnings than most.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/fs.h | 2 +-
+ include/linux/tty.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -900,7 +900,7 @@ struct file_handle {
+ __u32 handle_bytes;
+ int handle_type;
+ /* file identifier */
+- unsigned char f_handle[0];
++ unsigned char f_handle[];
+ };
+
+ static inline struct file *get_file(struct file *f)
+--- a/include/linux/tty.h
++++ b/include/linux/tty.h
+@@ -65,7 +65,7 @@ struct tty_buffer {
+ int read;
+ int flags;
+ /* Data points here */
+- unsigned long data[0];
++ unsigned long data[];
+ };
+
+ /* Values for .flags field of tty_buffer */
--- /dev/null
+From b303c6df80c9f8f13785aa83a0471fca7e38b24d Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+Date: Thu, 21 Feb 2019 13:13:38 +0900
+Subject: kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig
+
+From: Masahiro Yamada <yamada.masahiro@socionext.com>
+
+commit b303c6df80c9f8f13785aa83a0471fca7e38b24d upstream.
+
+Since -Wmaybe-uninitialized was introduced by GCC 4.7, we have patched
+various false positives:
+
+ - commit e74fc973b6e5 ("Turn off -Wmaybe-uninitialized when building
+ with -Os") turned off this option for -Os.
+
+ - commit 815eb71e7149 ("Kbuild: disable 'maybe-uninitialized' warning
+ for CONFIG_PROFILE_ALL_BRANCHES") turned off this option for
+ CONFIG_PROFILE_ALL_BRANCHES
+
+ - commit a76bcf557ef4 ("Kbuild: enable -Wmaybe-uninitialized warning
+ for "make W=1"") turned off this option for GCC < 4.9
+ Arnd provided more explanation in https://lkml.org/lkml/2017/3/14/903
+
+I think this looks better by shifting the logic from Makefile to Kconfig.
+
+Link: https://github.com/ClangBuiltLinux/linux/issues/350
+Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Tested-by: Nick Desaulniers <ndesaulniers@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 11 ++++-------
+ init/Kconfig | 17 +++++++++++++++++
+ kernel/trace/Kconfig | 1 +
+ 3 files changed, 22 insertions(+), 7 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -656,17 +656,14 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+ KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias)
+
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+-KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
+-else
+-ifdef CONFIG_PROFILE_ALL_BRANCHES
+-KBUILD_CFLAGS += -O2 $(call cc-disable-warning,maybe-uninitialized,)
++KBUILD_CFLAGS += -Os
+ else
+ KBUILD_CFLAGS += -O2
+ endif
+-endif
+
+-KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
+- $(call cc-disable-warning,maybe-uninitialized,))
++ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED
++KBUILD_CFLAGS += -Wno-maybe-uninitialized
++endif
+
+ # Tell gcc to never replace conditional load with a non-conditional one
+ KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -16,6 +16,22 @@ config DEFCONFIG_LIST
+ default "$ARCH_DEFCONFIG"
+ default "arch/$ARCH/defconfig"
+
++config CC_HAS_WARN_MAYBE_UNINITIALIZED
++ def_bool $(cc-option,-Wmaybe-uninitialized)
++ help
++ GCC >= 4.7 supports this option.
++
++config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
++ bool
++ depends on CC_HAS_WARN_MAYBE_UNINITIALIZED
++ default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9
++ help
++ GCC's -Wmaybe-uninitialized is not reliable by definition.
++ Lots of false positive warnings are produced in some cases.
++
++ If this option is enabled, -Wno-maybe-uninitialzed is passed
++ to the compiler to suppress maybe-uninitialized warnings.
++
+ config CONSTRUCTORS
+ bool
+ depends on !UML
+@@ -1044,6 +1060,7 @@ config CC_OPTIMIZE_FOR_PERFORMANCE
+
+ config CC_OPTIMIZE_FOR_SIZE
+ bool "Optimize for size"
++ imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
+ help
+ Enabling this option will pass "-Os" instead of "-O2" to
+ your compiler resulting in a smaller kernel.
+--- a/kernel/trace/Kconfig
++++ b/kernel/trace/Kconfig
+@@ -345,6 +345,7 @@ config PROFILE_ANNOTATED_BRANCHES
+ config PROFILE_ALL_BRANCHES
+ bool "Profile all if conditionals" if !FORTIFY_SOURCE
+ select TRACE_BRANCH_PROFILING
++ imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
+ help
+ This tracer profiles all branch conditions. Every if ()
+ taken in the kernel is recorded whether it hit or miss.
--- /dev/null
+From 01b2bafe57b19d9119413f138765ef57990921ce Mon Sep 17 00:00:00 2001
+From: Jason Gunthorpe <jgg@ziepe.ca>
+Date: Tue, 14 Apr 2020 12:10:50 -0300
+Subject: pnp: Use list_for_each_entry() instead of open coding
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jason Gunthorpe <jgg@mellanox.com>
+
+commit 01b2bafe57b19d9119413f138765ef57990921ce upstream.
+
+Aside from good practice, this avoids a warning from gcc 10:
+
+./include/linux/kernel.h:997:3: warning: array subscript -31 is outside array bounds of ‘struct list_head[1]’ [-Warray-bounds]
+ 997 | ((type *)(__mptr - offsetof(type, member))); })
+ | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+./include/linux/list.h:493:2: note: in expansion of macro ‘container_of’
+ 493 | container_of(ptr, type, member)
+ | ^~~~~~~~~~~~
+./include/linux/pnp.h:275:30: note: in expansion of macro ‘list_entry’
+ 275 | #define global_to_pnp_dev(n) list_entry(n, struct pnp_dev, global_list)
+ | ^~~~~~~~~~
+./include/linux/pnp.h:281:11: note: in expansion of macro ‘global_to_pnp_dev’
+ 281 | (dev) != global_to_pnp_dev(&pnp_global); \
+ | ^~~~~~~~~~~~~~~~~
+arch/x86/kernel/rtc.c:189:2: note: in expansion of macro ‘pnp_for_each_dev’
+ 189 | pnp_for_each_dev(dev) {
+
+Because the common code doesn't cast the starting list_head to the
+containing struct.
+
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+[ rjw: Whitespace adjustments ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/pnp.h | 29 +++++++++--------------------
+ 1 file changed, 9 insertions(+), 20 deletions(-)
+
+--- a/include/linux/pnp.h
++++ b/include/linux/pnp.h
+@@ -220,10 +220,8 @@ struct pnp_card {
+ #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list)
+ #define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list)
+ #define to_pnp_card(n) container_of(n, struct pnp_card, dev)
+-#define pnp_for_each_card(card) \
+- for((card) = global_to_pnp_card(pnp_cards.next); \
+- (card) != global_to_pnp_card(&pnp_cards); \
+- (card) = global_to_pnp_card((card)->global_list.next))
++#define pnp_for_each_card(card) \
++ list_for_each_entry(card, &pnp_cards, global_list)
+
+ struct pnp_card_link {
+ struct pnp_card *card;
+@@ -276,14 +274,9 @@ struct pnp_dev {
+ #define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list)
+ #define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list)
+ #define to_pnp_dev(n) container_of(n, struct pnp_dev, dev)
+-#define pnp_for_each_dev(dev) \
+- for((dev) = global_to_pnp_dev(pnp_global.next); \
+- (dev) != global_to_pnp_dev(&pnp_global); \
+- (dev) = global_to_pnp_dev((dev)->global_list.next))
+-#define card_for_each_dev(card,dev) \
+- for((dev) = card_to_pnp_dev((card)->devices.next); \
+- (dev) != card_to_pnp_dev(&(card)->devices); \
+- (dev) = card_to_pnp_dev((dev)->card_list.next))
++#define pnp_for_each_dev(dev) list_for_each_entry(dev, &pnp_global, global_list)
++#define card_for_each_dev(card, dev) \
++ list_for_each_entry(dev, &(card)->devices, card_list)
+ #define pnp_dev_name(dev) (dev)->name
+
+ static inline void *pnp_get_drvdata(struct pnp_dev *pdev)
+@@ -437,14 +430,10 @@ struct pnp_protocol {
+ };
+
+ #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list)
+-#define protocol_for_each_card(protocol,card) \
+- for((card) = protocol_to_pnp_card((protocol)->cards.next); \
+- (card) != protocol_to_pnp_card(&(protocol)->cards); \
+- (card) = protocol_to_pnp_card((card)->protocol_list.next))
+-#define protocol_for_each_dev(protocol,dev) \
+- for((dev) = protocol_to_pnp_dev((protocol)->devices.next); \
+- (dev) != protocol_to_pnp_dev(&(protocol)->devices); \
+- (dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
++#define protocol_for_each_card(protocol, card) \
++ list_for_each_entry(card, &(protocol)->cards, protocol_list)
++#define protocol_for_each_dev(protocol, dev) \
++ list_for_each_entry(dev, &(protocol)->devices, protocol_list)
+
+ extern struct bus_type pnp_bus_type;
+
netfilter-conntrack-avoid-gcc-10-zero-length-bounds-.patch
ib-mlx4-test-return-value-of-calls-to-ib_get_cached_.patch
hwmon-da9052-synchronize-access-with-mfd.patch
+pnp-use-list_for_each_entry-instead-of-open-coding.patch
+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
+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
+gcc-10-disable-restrict-warning-for-now.patch
+gcc-10-avoid-shadowing-standard-library-free-in-crypto.patch
+x86-asm-add-instruction-suffixes-to-bitops.patch
--- /dev/null
+From 78a5255ffb6a1af189a83e493d916ba1c54d8c75 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sat, 9 May 2020 13:57:10 -0700
+Subject: Stop the ad-hoc games with -Wno-maybe-initialized
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 78a5255ffb6a1af189a83e493d916ba1c54d8c75 upstream.
+
+We have some rather random rules about when we accept the
+"maybe-initialized" warnings, and when we don't.
+
+For example, we consider it unreliable for gcc versions < 4.9, but also
+if -O3 is enabled, or if optimizing for size. And then various kernel
+config options disabled it, because they know that they trigger that
+warning by confusing gcc sufficiently (ie PROFILE_ALL_BRANCHES).
+
+And now gcc-10 seems to be introducing a lot of those warnings too, so
+it falls under the same heading as 4.9 did.
+
+At the same time, we have a very straightforward way to _enable_ that
+warning when wanted: use "W=2" to enable more warnings.
+
+So stop playing these ad-hoc games, and just disable that warning by
+default, with the known and straight-forward "if you want to work on the
+extra compiler warnings, use W=123".
+
+Would it be great to have code that is always so obvious that it never
+confuses the compiler whether a variable is used initialized or not?
+Yes, it would. In a perfect world, the compilers would be smarter, and
+our source code would be simpler.
+
+That's currently not the world we live in, though.
+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Makefile | 7 +++----
+ init/Kconfig | 17 -----------------
+ kernel/trace/Kconfig | 1 -
+ 3 files changed, 3 insertions(+), 22 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -661,10 +661,6 @@ else
+ KBUILD_CFLAGS += -O2
+ endif
+
+-ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED
+-KBUILD_CFLAGS += -Wno-maybe-uninitialized
+-endif
+-
+ # Tell gcc to never replace conditional load with a non-conditional one
+ KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
+
+@@ -804,6 +800,9 @@ KBUILD_CFLAGS += $(call cc-disable-warni
+ # disable stringop warnings in gcc 8+
+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
+
++# Enabled with W=2, disabled by default as noisy
++KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
++
+ # disable invalid "can't wrap" optimizations for signed / pointers
+ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
+
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -16,22 +16,6 @@ config DEFCONFIG_LIST
+ default "$ARCH_DEFCONFIG"
+ default "arch/$ARCH/defconfig"
+
+-config CC_HAS_WARN_MAYBE_UNINITIALIZED
+- def_bool $(cc-option,-Wmaybe-uninitialized)
+- help
+- GCC >= 4.7 supports this option.
+-
+-config CC_DISABLE_WARN_MAYBE_UNINITIALIZED
+- bool
+- depends on CC_HAS_WARN_MAYBE_UNINITIALIZED
+- default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9
+- help
+- GCC's -Wmaybe-uninitialized is not reliable by definition.
+- Lots of false positive warnings are produced in some cases.
+-
+- If this option is enabled, -Wno-maybe-uninitialzed is passed
+- to the compiler to suppress maybe-uninitialized warnings.
+-
+ config CONSTRUCTORS
+ bool
+ depends on !UML
+@@ -1060,7 +1044,6 @@ config CC_OPTIMIZE_FOR_PERFORMANCE
+
+ config CC_OPTIMIZE_FOR_SIZE
+ bool "Optimize for size"
+- imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
+ help
+ Enabling this option will pass "-Os" instead of "-O2" to
+ your compiler resulting in a smaller kernel.
+--- a/kernel/trace/Kconfig
++++ b/kernel/trace/Kconfig
+@@ -345,7 +345,6 @@ config PROFILE_ANNOTATED_BRANCHES
+ config PROFILE_ALL_BRANCHES
+ bool "Profile all if conditionals" if !FORTIFY_SOURCE
+ select TRACE_BRANCH_PROFILING
+- imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives
+ help
+ This tracer profiles all branch conditions. Every if ()
+ taken in the kernel is recorded whether it hit or miss.
--- /dev/null
+From 22636f8c9511245cb3c8412039f1dd95afb3aa59 Mon Sep 17 00:00:00 2001
+From: Jan Beulich <JBeulich@suse.com>
+Date: Mon, 26 Feb 2018 04:11:51 -0700
+Subject: x86/asm: Add instruction suffixes to bitops
+
+From: Jan Beulich <JBeulich@suse.com>
+
+commit 22636f8c9511245cb3c8412039f1dd95afb3aa59 upstream.
+
+Omitting suffixes from instructions in AT&T mode is bad practice when
+operand size cannot be determined by the assembler from register
+operands, and is likely going to be warned about by upstream gas in the
+future (mine does already). Add the missing suffixes here. Note that for
+64-bit this means some operations change from being 32-bit to 64-bit.
+
+Signed-off-by: Jan Beulich <jbeulich@suse.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lkml.kernel.org/r/5A93F98702000078001ABACC@prv-mh.provo.novell.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/bitops.h | 29 ++++++++++++++++-------------
+ arch/x86/include/asm/percpu.h | 2 +-
+ 2 files changed, 17 insertions(+), 14 deletions(-)
+
+--- a/arch/x86/include/asm/bitops.h
++++ b/arch/x86/include/asm/bitops.h
+@@ -78,7 +78,7 @@ set_bit(long nr, volatile unsigned long
+ : "iq" ((u8)CONST_MASK(nr))
+ : "memory");
+ } else {
+- asm volatile(LOCK_PREFIX "bts %1,%0"
++ asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
+ : BITOP_ADDR(addr) : "Ir" (nr) : "memory");
+ }
+ }
+@@ -94,7 +94,7 @@ set_bit(long nr, volatile unsigned long
+ */
+ static __always_inline void __set_bit(long nr, volatile unsigned long *addr)
+ {
+- asm volatile("bts %1,%0" : ADDR : "Ir" (nr) : "memory");
++ asm volatile(__ASM_SIZE(bts) " %1,%0" : ADDR : "Ir" (nr) : "memory");
+ }
+
+ /**
+@@ -115,7 +115,7 @@ clear_bit(long nr, volatile unsigned lon
+ : CONST_MASK_ADDR(nr, addr)
+ : "iq" ((u8)~CONST_MASK(nr)));
+ } else {
+- asm volatile(LOCK_PREFIX "btr %1,%0"
++ asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
+ : BITOP_ADDR(addr)
+ : "Ir" (nr));
+ }
+@@ -137,7 +137,7 @@ static __always_inline void clear_bit_un
+
+ static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
+ {
+- asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
++ asm volatile(__ASM_SIZE(btr) " %1,%0" : ADDR : "Ir" (nr));
+ }
+
+ static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
+@@ -182,7 +182,7 @@ static __always_inline void __clear_bit_
+ */
+ static __always_inline void __change_bit(long nr, volatile unsigned long *addr)
+ {
+- asm volatile("btc %1,%0" : ADDR : "Ir" (nr));
++ asm volatile(__ASM_SIZE(btc) " %1,%0" : ADDR : "Ir" (nr));
+ }
+
+ /**
+@@ -201,7 +201,7 @@ static __always_inline void change_bit(l
+ : CONST_MASK_ADDR(nr, addr)
+ : "iq" ((u8)CONST_MASK(nr)));
+ } else {
+- asm volatile(LOCK_PREFIX "btc %1,%0"
++ asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
+ : BITOP_ADDR(addr)
+ : "Ir" (nr));
+ }
+@@ -217,7 +217,8 @@ static __always_inline void change_bit(l
+ */
+ static __always_inline bool test_and_set_bit(long nr, volatile unsigned long *addr)
+ {
+- GEN_BINARY_RMWcc(LOCK_PREFIX "bts", *addr, "Ir", nr, "%0", c);
++ GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(bts),
++ *addr, "Ir", nr, "%0", c);
+ }
+
+ /**
+@@ -246,7 +247,7 @@ static __always_inline bool __test_and_s
+ {
+ bool oldbit;
+
+- asm("bts %2,%1"
++ asm(__ASM_SIZE(bts) " %2,%1"
+ CC_SET(c)
+ : CC_OUT(c) (oldbit), ADDR
+ : "Ir" (nr));
+@@ -263,7 +264,8 @@ static __always_inline bool __test_and_s
+ */
+ static __always_inline bool test_and_clear_bit(long nr, volatile unsigned long *addr)
+ {
+- GEN_BINARY_RMWcc(LOCK_PREFIX "btr", *addr, "Ir", nr, "%0", c);
++ GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btr),
++ *addr, "Ir", nr, "%0", c);
+ }
+
+ /**
+@@ -286,7 +288,7 @@ static __always_inline bool __test_and_c
+ {
+ bool oldbit;
+
+- asm volatile("btr %2,%1"
++ asm volatile(__ASM_SIZE(btr) " %2,%1"
+ CC_SET(c)
+ : CC_OUT(c) (oldbit), ADDR
+ : "Ir" (nr));
+@@ -298,7 +300,7 @@ static __always_inline bool __test_and_c
+ {
+ bool oldbit;
+
+- asm volatile("btc %2,%1"
++ asm volatile(__ASM_SIZE(btc) " %2,%1"
+ CC_SET(c)
+ : CC_OUT(c) (oldbit), ADDR
+ : "Ir" (nr) : "memory");
+@@ -316,7 +318,8 @@ static __always_inline bool __test_and_c
+ */
+ static __always_inline bool test_and_change_bit(long nr, volatile unsigned long *addr)
+ {
+- GEN_BINARY_RMWcc(LOCK_PREFIX "btc", *addr, "Ir", nr, "%0", c);
++ GEN_BINARY_RMWcc(LOCK_PREFIX __ASM_SIZE(btc),
++ *addr, "Ir", nr, "%0", c);
+ }
+
+ static __always_inline bool constant_test_bit(long nr, const volatile unsigned long *addr)
+@@ -329,7 +332,7 @@ static __always_inline bool variable_tes
+ {
+ bool oldbit;
+
+- asm volatile("bt %2,%1"
++ asm volatile(__ASM_SIZE(bt) " %2,%1"
+ CC_SET(c)
+ : CC_OUT(c) (oldbit)
+ : "m" (*(unsigned long *)addr), "Ir" (nr));
+--- a/arch/x86/include/asm/percpu.h
++++ b/arch/x86/include/asm/percpu.h
+@@ -526,7 +526,7 @@ static inline bool x86_this_cpu_variable
+ {
+ bool oldbit;
+
+- asm volatile("bt "__percpu_arg(2)",%1"
++ asm volatile("btl "__percpu_arg(2)",%1"
+ CC_SET(c)
+ : CC_OUT(c) (oldbit)
+ : "m" (*(unsigned long __percpu *)addr), "Ir" (nr));