linux-stable/drivers/firmware
Jean Delvare a7770ae194 firmware: dmi_scan: Fix handling of empty DMI strings
The handling of empty DMI strings looks quite broken to me:
* Strings from 1 to 7 spaces are not considered empty.
* True empty DMI strings (string index set to 0) are not considered
  empty, and result in allocating a 0-char string.
* Strings with invalid index also result in allocating a 0-char
  string.
* Strings starting with 8 spaces are all considered empty, even if
  non-space characters follow (sounds like a weird thing to do, but
  I have actually seen occurrences of this in DMI tables before.)
* Strings which are considered empty are reported as 8 spaces,
  instead of being actually empty.

Some of these issues are the result of an off-by-one error in memcmp,
the rest is incorrect by design.

So let's get it square: missing strings and strings made of only
spaces, regardless of their length, should be treated as empty and
no memory should be allocated for them. All other strings are
non-empty and should be allocated.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 79da472111 ("x86: fix DMI out of memory problems")
Cc: Parag Warudkar <parag.warudkar@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
2018-02-03 11:25:20 +01:00
..
broadcom tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
efi efi/capsule-loader: Reinstate virtual capsule mapping 2018-01-03 13:54:31 +01:00
google firmware: vpd: Fix platform driver and device registration/unregistration 2017-11-28 16:57:18 +01:00
meson firmware: meson-sm: Allow 0 as valid return value 2017-03-23 12:22:40 -07:00
tegra ARM: SoC driver updates for v4.15 2017-11-16 16:05:01 -08:00
arm_scpi.c firmware: arm_scpi: Revert updates made during v4.15 merge window 2017-12-03 19:39:22 -08:00
dcdbas.c firmware/dcdbas: Constify attribute_group structures 2017-08-21 09:43:51 +02:00
dcdbas.h
dell_rbu.c
dmi-id.c firmware: dmi: Fix permissions of product_family 2017-06-15 13:46:01 +02:00
dmi-sysfs.c x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap() for RAM mappings 2017-07-18 11:37:58 +02:00
dmi_scan.c firmware: dmi_scan: Fix handling of empty DMI strings 2018-02-03 11:25:20 +01:00
edd.c
iscsi_ibft.c ibft: Expose iBFT acpi header via sysfs 2016-05-16 11:14:29 -04:00
iscsi_ibft_find.c efi: Make 'efi_enabled' a function to query EFI facilities 2013-01-30 11:51:59 -08:00
Kconfig firmware: qcom: scm: Expose download-mode control 2017-10-11 23:48:27 -05:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
memmap.c drivers/firmware/memmap.c: fix kernel-doc format 2015-06-25 17:00:41 -07:00
pcdp.c x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap() for RAM mappings 2017-07-18 11:37:58 +02:00
pcdp.h
psci.c firmware: Convert to using %pOF instead of full_name 2017-08-16 17:19:50 +02:00
psci_checker.c drivers/firmware: psci: Convert timers to use timer_setup() 2017-11-21 15:46:44 -08:00
qcom_scm-32.c remoteproc updates for v4.15 2017-11-17 20:14:10 -08:00
qcom_scm-64.c remoteproc updates for v4.15 2017-11-17 20:14:10 -08:00
qcom_scm.c remoteproc updates for v4.15 2017-11-17 20:14:10 -08:00
qcom_scm.h remoteproc updates for v4.15 2017-11-17 20:14:10 -08:00
qemu_fw_cfg.c fw_cfg: fix driver remove 2017-12-01 16:55:09 +02:00
raspberrypi.c ARM: bcm2835: Add the Raspberry Pi firmware driver 2015-10-14 15:30:06 -07:00
scpi_pm_domain.c firmware: scpi: add device power domain support using genpd 2016-06-21 10:26:51 +01:00
ti_sci.c ti_sci: Use %pS printk format for direct addresses 2017-10-09 09:54:14 -07:00
ti_sci.h firmware: ti_sci: Add support for reboot core service 2016-10-27 12:09:12 +03:00