Re: [PATCH] net/3com/3c515: Fix MODULE_ARCH_VERMAGIC redefinition

From: Leon Romanovsky
Date: Sat Apr 11 2020 - 12:12:04 EST


On Sat, Apr 11, 2020 at 05:56:23PM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Change the include order so that MODULE_ARCH_VERMAGIC from the arch
> header arch/x86/include/asm/module.h gets used instead of the fallback
> from include/linux/vermagic.h and thus fix:
>
> In file included from ./include/linux/module.h:30,
> from drivers/net/ethernet/3com/3c515.c:56:
> ./arch/x86/include/asm/module.h:73: warning: "MODULE_ARCH_VERMAGIC" redefined
> 73 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
> |
> In file included from drivers/net/ethernet/3com/3c515.c:25:
> ./include/linux/vermagic.h:28: note: this is the location of the previous definition
> 28 | #define MODULE_ARCH_VERMAGIC ""
> |
>
> Fixes: 6bba2e89a88c ("net/3com: Delete driver and module versions from 3com drivers")
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> ---
> drivers/net/ethernet/3com/3c515.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Probably, this is the right change, but I have a feeling that the right
solution will be inside headers itself. It is a little bit strange that
both very common kernel headers like module.h and vermagic.h are location
dependant.

Thanks

>
> diff --git a/drivers/net/ethernet/3com/3c515.c b/drivers/net/ethernet/3com/3c515.c
> index 90312fcd6319..cdceef891dbd 100644
> --- a/drivers/net/ethernet/3com/3c515.c
> +++ b/drivers/net/ethernet/3com/3c515.c
> @@ -22,7 +22,6 @@
>
> */
>
> -#include <linux/vermagic.h>
> #define DRV_NAME "3c515"
>
> #define CORKSCREW 1
> @@ -67,6 +66,7 @@ static int max_interrupt_work = 20;
> #include <linux/timer.h>
> #include <linux/ethtool.h>
> #include <linux/bitops.h>
> +#include <linux/vermagic.h>
>
> #include <linux/uaccess.h>
> #include <asm/io.h>
> --
> 2.21.0
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette