Skip to content

Commit ac8c6ed

Browse files
committed
Merge tag 'efi-urgent-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI fix from Borislav Petkov: "A single fix from Lukas: handle boolean device properties imported from Apple firmware correctly" * tag 'efi-urgent-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi/apple-properties: Reinstate support for boolean properties
2 parents f5a376e + 355845b commit ac8c6ed

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/firmware/efi/apple-properties.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* apple-properties.c - EFI device properties on Macs
44
* Copyright (C) 2016 Lukas Wunner <[email protected]>
55
*
6-
* Note, all properties are considered as u8 arrays.
7-
* To get a value of any of them the caller must use device_property_read_u8_array().
6+
* Properties are stored either as:
7+
* u8 arrays which can be retrieved with device_property_read_u8_array() or
8+
* booleans which can be queried with device_property_present().
89
*/
910

1011
#define pr_fmt(fmt) "apple-properties: " fmt
@@ -88,8 +89,12 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
8889

8990
entry_data = ptr + key_len + sizeof(val_len);
9091
entry_len = val_len - sizeof(val_len);
91-
entry[i] = PROPERTY_ENTRY_U8_ARRAY_LEN(key, entry_data,
92-
entry_len);
92+
if (entry_len)
93+
entry[i] = PROPERTY_ENTRY_U8_ARRAY_LEN(key, entry_data,
94+
entry_len);
95+
else
96+
entry[i] = PROPERTY_ENTRY_BOOL(key);
97+
9398
if (dump_properties) {
9499
dev_info(dev, "property: %s\n", key);
95100
print_hex_dump(KERN_INFO, pr_fmt(), DUMP_PREFIX_OFFSET,

0 commit comments

Comments
 (0)