Re: [PATCH] dmi: mark all struct dmi_system_id instances const

From: Jean Delvare
Date: Mon Jul 31 2017 - 04:02:03 EST


Hi Christoph,

Sorry for the delay, this patch slipped trough the cracks somehow, I
only noticed it in my mailbox today.

On Mon, 15 May 2017 22:30:56 +0200, Christoph Hellwig wrote:
> ... and __initconst if applicable.
>
> Based on similar work for an older kernel in the Grsecurity patch.

On the principle I think it is a good idea. I am not sure if pushing it
as a single patch through my dmi tree is the best thing to do, as it
could result in conflicts. The other option is to break it out on a per
subsystem basis. That being said, I just tried to apply this 2.5 months
later and there was no single conflict, so maybe a single patch is fine.

One issue though:

> (...)
> diff --git a/drivers/platform/x86/toshiba-wmi.c b/drivers/platform/x86/toshiba-wmi.c
> index 440528676170..1756ccf69612 100644
> --- a/drivers/platform/x86/toshiba-wmi.c
> +++ b/drivers/platform/x86/toshiba-wmi.c
> @@ -64,7 +64,7 @@ static void toshiba_wmi_notify(u32 value, void *context)
> kfree(response.pointer);
> }
>
> -static struct dmi_system_id toshiba_wmi_dmi_table[] __initdata = {
> +static struct const dmi_system_id toshiba_wmi_dmi_table[] __initconst = {
> {
> .ident = "Toshiba laptop",
> .matches = {

"struct const dmi_system_id" doesn't build, it should be "const struct
dmi_system_id".

I'll fix that up. Also I see a new instance to fix in
drivers/input/touchscreen/htcpen.c, I'll take care of that.

Lastly checkpatch complains about the position of __initconst on 18
instances, I'll fix that as well.

Thanks,
--
Jean Delvare
SUSE L3 Support