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]
Date:   Mon, 16 Mar 2020 17:27:30 +0200
From:   Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Mark Brown <broonie@...nel.org>, linux-kernel@...r.kernel.org,
        alexander.shishkin@...ux.intel.com
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v3 5/9] x86/quirks: Convert DMI matching to use a table

Andy Shevchenko <andriy.shevchenko@...ux.intel.com> writes:

> +static const struct dmi_system_id x86_machine_table[] __initconst = {
> +	{
> +		.ident = "x86 Apple Macintosh",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
> +		},
> +		.driver_data = &x86_apple_machine,
> +	},
> +	{
> +		.ident = "x86 Apple Macintosh",
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
> +		},
> +		.driver_data = &x86_apple_machine,
> +	},
> +	{}
> +};
> +
> +static void __init early_platform_detect_quirk(void)
> +{
> +	const struct dmi_system_id *id;
> +
> +	id = dmi_first_match(x86_machine_table);
> +	if (!id)
> +		return;
> +
> +	printk(KERN_DEBUG "Detected %s platform\n", id->ident);
> +	*((bool *)id->driver_data) = true;

I'd suggest that x86_apple_machine and the ones that you add further
down this patchset, be made functions instead. That way you could at
first hide the global bool(s) and then replace this with something a
little more type safe.

Regards,
--
Alex

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ