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:	Wed, 13 Jul 2011 10:51:05 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Len Brown <lenb@...nel.org>
Cc:	linux-pm@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mrst_pmu: driver for Intel Moorestown Power Management
 Unit

> +static struct mrst_device *pci_id_2_mrst_dev(u16 pci_dev_num)
> +{
> +	int index;
> +
> +	if ((pci_dev_num >= 0x0800) && (pci_dev_num <= 0x815))
> +		index = pci_dev_num - 0x800;
> +	else if (pci_dev_num == 0x084F)
> +		index = 22;
> +	else if (pci_dev_num == 0x4102)
> +		index = 23;
> +	else if (pci_dev_num == 0x4110)
> +		index = 24;
> +	else
> +		BUG();
> +
> +	BUG_ON(pci_dev_num != mrst_devs[index].pci_dev_num);

That strikes me as needlessly unfriendly, you could warn/return NULL and
propogate a WARN_ONCE back to the user.

> +static int __init scu_fw_check(void)
> +{
> +	int ret;
> +	u32 fw_version;
> +
> +	sfi_table_parse("OEMB", NULL, NULL, pmu_sfi_parse_oem);
> +
> +	if (ia_major < 0x6005 || ia_minor < 0x1525) {
> +		WARN(1, "mrst_pmu: IA FW version too old\n");
> +		return -1;
> +	}
> +
> +	ret = intel_scu_ipc_command(IPCMSG_FW_REVISION, 0, NULL, 0,
> +					&fw_version, 1);
> +
> +	if (ret) {
> +		WARN(1, "mrst_pmu: IPC FW version? %d\n", ret);
> +	} else {
> +		int scu_major = (fw_version >> 8) & 0xFF;
> +		int scu_minor = (fw_version >> 0) & 0xFF;
> +
> +		printk(KERN_INFO "mrst_pmu: firmware v%x\n", fw_version);
> +
> +		if ((scu_major >= 0xC0) && (scu_minor >= 0x49)) {
> +			printk(KERN_INFO "mrst_pmu: enabling S0i3\n");
> +			mrst_pmu_s0i3_enable = true;
> +		} else {
> +			WARN(1, "mrst_pmu: S0i3 disabled, old firmware %X.%X",
> +					scu_major, scu_minor);
> +		}
> +	}
> +	return 0;
> +}
> +late_initcall(scu_fw_check);

NAK. I pointed this problem with the driver to you way back - this code
gets run always - even on machines that are not in fact Moorestown which
are then going to crash.

You need to check that the platform is Moorestown (not just the CPU
either because of Oaktrail)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ