When building with C=1 W=1, both sparse and gcc complain:
CHECK arch/x86/kernel/cpu/microcode/core.c
./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
CC arch/x86/kernel/cpu/microcode/core.o
In file included from arch/x86/kernel/cpu/microcode/core.c:36:
./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
]
56 | void reload_ucode_amd(void) {}
| ^~~~~~~~~~~~~~~~
And they're right - that function can be a static inline like its brethren.
Signed-off-by: Valdis Kletnieks <[email protected]>
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
index 209492849566..6685e1218959 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -53,6 +53,6 @@ static inline void __init load_ucode_amd_bsp(unsigned int family) {}
static inline void load_ucode_amd_ap(unsigned int family) {}
static inline int __init
save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; }
-void reload_ucode_amd(void) {}
+static inline void reload_ucode_amd(void) {}
#endif
#endif /* _ASM_X86_MICROCODE_AMD_H */
On Thu, Dec 05, 2019 at 10:44:33PM -0500, Valdis Klētnieks wrote:
> When building with C=1 W=1, both sparse and gcc complain:
>
> CHECK arch/x86/kernel/cpu/microcode/core.c
> ./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
> CC arch/x86/kernel/cpu/microcode/core.o
> In file included from arch/x86/kernel/cpu/microcode/core.c:36:
> ./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
> ]
Hmm, I don't see this with gcc 9.2 and sparse 0.6.1 here.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
On Wed, 11 Dec 2019 22:38:19 +0100, Borislav Petkov said:
> > CHECK arch/x86/kernel/cpu/microcode/core.c
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
> > CC arch/x86/kernel/cpu/microcode/core.o
> > In file included from arch/x86/kernel/cpu/microcode/core.c:36:
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
> > ]
>
> Hmm, I don't see this with gcc 9.2 and sparse 0.6.1 here.
Were you building with W=1 (so gcc issues extra warnings) and C=1 or 2 so sparse is run?
On Wed, Dec 11, 2019 at 06:33:53PM -0500, Valdis Klētnieks wrote:
> Were you building with W=1 (so gcc issues extra warnings) and C=1 or 2
> so sparse is run?
[boris@zn: ~/kernel/linux> make W=1 C=1 arch/x86/kernel/cpu/microcode/
...
LINK /mnt/kernel/kernel/linux/tools/objtool/objtool
CHECK arch/x86/kernel/cpu/microcode/core.c
CC arch/x86/kernel/cpu/microcode/core.o
CHECK arch/x86/kernel/cpu/microcode/intel.c
CC arch/x86/kernel/cpu/microcode/intel.o
CHECK arch/x86/kernel/cpu/microcode/amd.c
arch/x86/kernel/cpu/microcode/amd.c:421:35: warning: Using plain integer as NULL pointer
arch/x86/kernel/cpu/microcode/amd.c:546:35: warning: Using plain integer as NULL pointer
CC arch/x86/kernel/cpu/microcode/amd.o
AR arch/x86/kernel/cpu/microcode/built-in.a
[boris@zn: ~/kernel/linux> git clean -dqfx
...
[boris@zn: ~/kernel/linux> make W=1 C=2 arch/x86/kernel/cpu/microcode/
LINK /mnt/kernel/kernel/linux/tools/objtool/objtool
CHECK arch/x86/kernel/cpu/microcode/core.c
CC arch/x86/kernel/cpu/microcode/core.o
CHECK arch/x86/kernel/cpu/microcode/intel.c
CC arch/x86/kernel/cpu/microcode/intel.o
CHECK arch/x86/kernel/cpu/microcode/amd.c
arch/x86/kernel/cpu/microcode/amd.c:421:35: warning: Using plain integer as NULL pointer
arch/x86/kernel/cpu/microcode/amd.c:546:35: warning: Using plain integer as NULL pointer
CC arch/x86/kernel/cpu/microcode/amd.o
AR arch/x86/kernel/cpu/microcode/built-in.a
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
On Thu, Dec 12, 2019 at 09:58:09AM +0100, Borislav Petkov wrote:
> On Wed, Dec 11, 2019 at 06:33:53PM -0500, Valdis Klētnieks wrote:
> > Were you building with W=1 (so gcc issues extra warnings) and C=1 or 2
> > so sparse is run?
>
> [boris@zn: ~/kernel/linux> make W=1 C=1 arch/x86/kernel/cpu/microcode/
> ...
The Sparse warning about reload_ucode_amd() is only present if your
config has CONFIG_MICROCODE_AMD not set.
Best regards,
-- Luc
On Thu, Dec 12, 2019 at 11:06:09AM +0100, Luc Van Oostenryck wrote:
> The Sparse warning about reload_ucode_amd() is only present if your
> config has CONFIG_MICROCODE_AMD not set.
Ha, of course. Otherwise it doesn't see the
void reload_ucode_amd(void) {}
declaration.
Thanks for pointing this out.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
From Borislav Petkov
> Sent: 11 December 2019 21:38
> On Thu, Dec 05, 2019 at 10:44:33PM -0500, Valdis Klētnieks wrote:
> > When building with C=1 W=1, both sparse and gcc complain:
> >
> > CHECK arch/x86/kernel/cpu/microcode/core.c
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol 'reload_ucode_amd' was not declared. Should it be static?
> > CC arch/x86/kernel/cpu/microcode/core.o
> > In file included from arch/x86/kernel/cpu/microcode/core.c:36:
> > ./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous prototype for 'reload_ucode_amd' [-Wmissing-prototypes
> > ]
>
> Hmm, I don't see this with gcc 9.2 and sparse 0.6.1 here.
ISTR it is gcc-version dependant.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
The following commit has been merged into the x86/microcode branch of tip:
Commit-ID: 82c881b28aa89215a760e39c5f6bcde2d6ce4918
Gitweb: https://git.kernel.org/tip/82c881b28aa89215a760e39c5f6bcde2d6ce4918
Author: Valdis Klētnieks <[email protected]>
AuthorDate: Thu, 05 Dec 2019 22:44:33 -05:00
Committer: Borislav Petkov <[email protected]>
CommitterDate: Thu, 12 Dec 2019 22:29:00 +01:00
x86/microcode/AMD: Make stub function static inline
When building with C=1 W=1 (and when CONFIG_MICROCODE_AMD=n, as Luc Van
Oostenryck correctly points out) both sparse and gcc complain:
CHECK arch/x86/kernel/cpu/microcode/core.c
./arch/x86/include/asm/microcode_amd.h:56:6: warning: symbol \
'reload_ucode_amd' was not declared. Should it be static?
CC arch/x86/kernel/cpu/microcode/core.o
In file included from arch/x86/kernel/cpu/microcode/core.c:36:
./arch/x86/include/asm/microcode_amd.h:56:6: warning: no previous \
prototype for 'reload_ucode_amd' [-Wmissing-prototypes]
56 | void reload_ucode_amd(void) {}
| ^~~~~~~~~~~~~~~~
And they're right - that function can be a static inline like its
brethren.
Signed-off-by: Valdis Klētnieks <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Cc: Luc Van Oostenryck <[email protected]>
Cc: [email protected]
Link: https://lkml.kernel.org/r/52170.1575603873@turing-police
---
arch/x86/include/asm/microcode_amd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
index 2094928..6685e12 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -53,6 +53,6 @@ static inline void __init load_ucode_amd_bsp(unsigned int family) {}
static inline void load_ucode_amd_ap(unsigned int family) {}
static inline int __init
save_microcode_in_initrd_amd(unsigned int family) { return -EINVAL; }
-void reload_ucode_amd(void) {}
+static inline void reload_ucode_amd(void) {}
#endif
#endif /* _ASM_X86_MICROCODE_AMD_H */