lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e818c889-40f8-0318-e29d-372da57c33d8@redhat.com>
Date:   Wed, 9 Aug 2023 21:59:27 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     Jean Delvare <jdelvare@...e.de>,
        platform-driver-x86@...r.kernel.org
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Mark Gross <markgross@...nel.org>,
        Nikita Kravets <teackot@...il.com>
Subject: Re: [PATCH] platform/x86: msi-ec: Fix the build

Hi,

On 8/5/23 10:10, Jean Delvare wrote:
> The msi-ec driver fails to build for me (gcc 7.5):
> 
>   CC [M]  drivers/platform/x86/msi-ec.o
> drivers/platform/x86/msi-ec.c:72:6: error: initializer element is not constant
>     { SM_ECO_NAME,     0xc2 },
>       ^~~~~~~~~~~
> drivers/platform/x86/msi-ec.c:72:6: note: (near initialization for ‘CONF0.shift_mode.modes[0].name’)
> drivers/platform/x86/msi-ec.c:73:6: error: initializer element is not constant
>     { SM_COMFORT_NAME, 0xc1 },
>       ^~~~~~~~~~~~~~~
> drivers/platform/x86/msi-ec.c:73:6: note: (near initialization for ‘CONF0.shift_mode.modes[1].name’)
> drivers/platform/x86/msi-ec.c:74:6: error: initializer element is not constant
>     { SM_SPORT_NAME,   0xc0 },
>       ^~~~~~~~~~~~~
> drivers/platform/x86/msi-ec.c:74:6: note: (near initialization for ‘CONF0.shift_mode.modes[2].name’)
> (...)
> 
> Don't try to be smart, just use defines for the constant strings. The
> compiler will recognize it's the same string and will store it only
> once in the data section anyway.
> 
> Signed-off-by: Jean Delvare <jdelvare@...e.de>
> Fixes: 392cacf2aa10 ("platform/x86: Add new msi-ec driver")
> Cc: stable@...r.kernel.org
> Cc: Nikita Kravets <teackot@...il.com>
> Cc: Hans de Goede <hdegoede@...hat.com>
> Cc: Mark Gross <markgross@...nel.org>

Thank you for your patch, I've applied this patch to my fixes
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes

I will include this patch in my next fixes pull-req to Linus
for the current kernel development cycle.

Regards,

Hans







> ---
>  drivers/platform/x86/msi-ec.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> --- linux-6.4.orig/drivers/platform/x86/msi-ec.c
> +++ linux-6.4/drivers/platform/x86/msi-ec.c
> @@ -27,15 +27,15 @@
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  
> -static const char *const SM_ECO_NAME       = "eco";
> -static const char *const SM_COMFORT_NAME   = "comfort";
> -static const char *const SM_SPORT_NAME     = "sport";
> -static const char *const SM_TURBO_NAME     = "turbo";
> +#define SM_ECO_NAME		"eco"
> +#define SM_COMFORT_NAME		"comfort"
> +#define SM_SPORT_NAME		"sport"
> +#define SM_TURBO_NAME		"turbo"
>  
> -static const char *const FM_AUTO_NAME     = "auto";
> -static const char *const FM_SILENT_NAME   = "silent";
> -static const char *const FM_BASIC_NAME    = "basic";
> -static const char *const FM_ADVANCED_NAME = "advanced";
> +#define FM_AUTO_NAME		"auto"
> +#define FM_SILENT_NAME		"silent"
> +#define FM_BASIC_NAME		"basic"
> +#define FM_ADVANCED_NAME	"advanced"
>  
>  static const char * const ALLOWED_FW_0[] __initconst = {
>  	"14C1EMS1.012",
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ