stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.4] x86, boot: Remove multiple copy of static function sanitize_boot_params()
@ 2019-09-12  7:21 Nathan Chancellor
  2019-09-12 10:31 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2019-09-12  7:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sasha Levin
  Cc: stable, clang-built-linux, Ilie Halip, Nick Desaulniers,
	Zhenzhong Duan, Thomas Gleixner, Nathan Chancellor

From: Zhenzhong Duan <zhenzhong.duan@oracle.com>

commit 8c5477e8046ca139bac250386c08453da37ec1ae upstream.

Kernel build warns:
 'sanitize_boot_params' defined but not used [-Wunused-function]

at below files:
  arch/x86/boot/compressed/cmdline.c
  arch/x86/boot/compressed/error.c
  arch/x86/boot/compressed/early_serial_console.c
  arch/x86/boot/compressed/acpi.c

That's becausethey each include misc.h which includes a definition of
sanitize_boot_params() via bootparam_utils.h.

Remove the inclusion from misc.h and have the c file including
bootparam_utils.h directly.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/1563283092-1189-1-git-send-email-zhenzhong.duan@oracle.com
[nc: Fixed conflict around lack of 67b6662559f7f]
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

Hi Greg and Sasha,

Please consider applying this to 4.4 as it resolves a compilation error
with clang on 4.4 and it has already been applied to 4.9 and newer:

https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/232287034

https://github.com/ClangBuiltLinux/linux/issues/654

Thanks to Ilie Halip for debugging this; TL;DR: clang pretends that it
is GCC 4.2.1 for glibc compatibility and this trips up a definition of
memcpy for GCC < 4.3. This is not an issue on mainline because GCC 4.6
is the earliest supported GCC version so that code was removed and this
patch resolves it because string.h redefines memcpy to a proper version.

 arch/x86/boot/compressed/misc.c | 1 +
 arch/x86/boot/compressed/misc.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 16df89c30c20..1e5b68228aff 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -11,6 +11,7 @@
 
 #include "misc.h"
 #include "../string.h"
+#include <asm/bootparam_utils.h>
 
 /* WARNING!!
  * This code is compiled with -fPIC and it is relocated dynamically
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 4abb284a5b9c..bce182708814 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -19,7 +19,6 @@
 #include <asm/page.h>
 #include <asm/boot.h>
 #include <asm/bootparam.h>
-#include <asm/bootparam_utils.h>
 
 #define BOOT_BOOT_H
 #include "../ctype.h"
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4.4] x86, boot: Remove multiple copy of static function sanitize_boot_params()
  2019-09-12  7:21 [PATCH 4.4] x86, boot: Remove multiple copy of static function sanitize_boot_params() Nathan Chancellor
@ 2019-09-12 10:31 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-09-12 10:31 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Sasha Levin, stable, clang-built-linux, Ilie Halip,
	Nick Desaulniers, Zhenzhong Duan, Thomas Gleixner

On Thu, Sep 12, 2019 at 12:21:48AM -0700, Nathan Chancellor wrote:
> From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> 
> commit 8c5477e8046ca139bac250386c08453da37ec1ae upstream.
> 
> Kernel build warns:
>  'sanitize_boot_params' defined but not used [-Wunused-function]
> 
> at below files:
>   arch/x86/boot/compressed/cmdline.c
>   arch/x86/boot/compressed/error.c
>   arch/x86/boot/compressed/early_serial_console.c
>   arch/x86/boot/compressed/acpi.c
> 
> That's becausethey each include misc.h which includes a definition of
> sanitize_boot_params() via bootparam_utils.h.
> 
> Remove the inclusion from misc.h and have the c file including
> bootparam_utils.h directly.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Link: https://lkml.kernel.org/r/1563283092-1189-1-git-send-email-zhenzhong.duan@oracle.com
> [nc: Fixed conflict around lack of 67b6662559f7f]
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 
> Hi Greg and Sasha,
> 
> Please consider applying this to 4.4 as it resolves a compilation error
> with clang on 4.4 and it has already been applied to 4.9 and newer:
> 
> https://travis-ci.com/ClangBuiltLinux/continuous-integration/jobs/232287034
> 
> https://github.com/ClangBuiltLinux/linux/issues/654
> 
> Thanks to Ilie Halip for debugging this; TL;DR: clang pretends that it
> is GCC 4.2.1 for glibc compatibility and this trips up a definition of
> memcpy for GCC < 4.3. This is not an issue on mainline because GCC 4.6
> is the earliest supported GCC version so that code was removed and this
> patch resolves it because string.h redefines memcpy to a proper version.

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-12 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12  7:21 [PATCH 4.4] x86, boot: Remove multiple copy of static function sanitize_boot_params() Nathan Chancellor
2019-09-12 10:31 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).