From: Greg Kroah-Hartman Date: Mon, 5 Jun 2023 17:07:05 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.14.317~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=727a71597f3a1d42696a48bf92c798386bf79fe9;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: acpi-thermal-drop-an-always-true-check.patch gcc-12-disable-wdangling-pointer-warning-for-now.patch --- diff --git a/queue-5.4/acpi-thermal-drop-an-always-true-check.patch b/queue-5.4/acpi-thermal-drop-an-always-true-check.patch new file mode 100644 index 00000000000..4fd40409381 --- /dev/null +++ b/queue-5.4/acpi-thermal-drop-an-always-true-check.patch @@ -0,0 +1,30 @@ +From e5b5d25444e9ee3ae439720e62769517d331fa39 Mon Sep 17 00:00:00 2001 +From: Adam Borowski +Date: Mon, 15 Nov 2021 18:32:08 +0100 +Subject: ACPI: thermal: drop an always true check + +From: Adam Borowski + +commit e5b5d25444e9ee3ae439720e62769517d331fa39 upstream. + +Address of a field inside a struct can't possibly be null; gcc-12 warns +about this. + +Signed-off-by: Adam Borowski +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/acpi/thermal.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/acpi/thermal.c ++++ b/drivers/acpi/thermal.c +@@ -1153,8 +1153,6 @@ static int acpi_thermal_resume(struct de + return -EINVAL; + + for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { +- if (!(&tz->trips.active[i])) +- break; + if (!tz->trips.active[i].flags.valid) + break; + tz->trips.active[i].flags.enabled = 1; diff --git a/queue-5.4/gcc-12-disable-wdangling-pointer-warning-for-now.patch b/queue-5.4/gcc-12-disable-wdangling-pointer-warning-for-now.patch new file mode 100644 index 00000000000..3810dcdedeb --- /dev/null +++ b/queue-5.4/gcc-12-disable-wdangling-pointer-warning-for-now.patch @@ -0,0 +1,68 @@ +From f7d63b50898172b9eb061b9e2daad61b428792d0 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Thu, 9 Jun 2022 09:41:42 -0700 +Subject: gcc-12: disable '-Wdangling-pointer' warning for now +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Linus Torvalds + +commit f7d63b50898172b9eb061b9e2daad61b428792d0 upstream. + +[ Upstream commit 49beadbd47c270a00754c107a837b4f29df4c822 ] + +While the concept of checking for dangling pointers to local variables +at function exit is really interesting, the gcc-12 implementation is not +compatible with reality, and results in false positives. + +For example, gcc sees us putting things on a local list head allocated +on the stack, which involves exactly those kinds of pointers to the +local stack entry: + + In function ‘__list_add’, + inlined from ‘list_add_tail’ at include/linux/list.h:102:2, + inlined from ‘rebuild_snap_realms’ at fs/ceph/snap.c:434:2: + include/linux/list.h:74:19: warning: storing the address of local variable ‘realm_queue’ in ‘*&realm_27(D)->rebuild_item.prev’ [-Wdangling-pointer=] + 74 | new->prev = prev; + | ~~~~~~~~~~^~~~~~ + +But then gcc - understandably - doesn't really understand the big +picture how the doubly linked list works, so doesn't see how we then end +up emptying said list head in a loop and the pointer we added has been +removed. + +Gcc also complains about us (intentionally) using this as a way to store +a kind of fake stack trace, eg + + drivers/acpi/acpica/utdebug.c:40:38: warning: storing the address of local variable ‘current_sp’ in ‘acpi_gbl_entry_stack_pointer’ [-Wdangling-pointer=] + 40 | acpi_gbl_entry_stack_pointer = ¤t_sp; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ + +which is entirely reasonable from a compiler standpoint, and we may want +to change those kinds of patterns, but not not. + +So this is one of those "it would be lovely if the compiler were to +complain about us leaving dangling pointers to the stack", but not this +way. + +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +Signed-off-by: Greg Kroah-Hartman +--- + Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/Makefile ++++ b/Makefile +@@ -783,6 +783,10 @@ endif + KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) + + KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ++ ++# These result in bogus false positives ++KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer) ++ + ifdef CONFIG_FRAME_POINTER + KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls + else diff --git a/queue-5.4/series b/queue-5.4/series index 0fc9be4dcab..617e561ff5c 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -72,3 +72,5 @@ scsi-stex-fix-gcc-13-warnings.patch ata-libata-scsi-use-correct-device-no-in-ata_find_dev.patch flow_dissector-work-around-stack-frame-size-warning.patch x86-boot-wrap-literal-addresses-in-absolute_pointer.patch +acpi-thermal-drop-an-always-true-check.patch +gcc-12-disable-wdangling-pointer-warning-for-now.patch