[RFC PATCH v1] efi/apple-properties: Assume 32-bit values only for now

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is as far as we know no type field in the struct dev_header
provided. Thus, assume that values of all properties are type of u32.

Deterministic type of property values is required to avoid union
aliasing in the code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---

- the union aliasing fix for built-in device properties will be sent during
next cycle, though I can share through one of my temporary branches if needed

 drivers/firmware/efi/apple-properties.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c
index b9602e0d7b50..a4847bcd26be 100644
--- a/drivers/firmware/efi/apple-properties.c
+++ b/drivers/firmware/efi/apple-properties.c
@@ -40,8 +40,9 @@ struct dev_header {
 	u32 prop_count;
 	struct efi_dev_path path[0];
 	/*
-	 * followed by key/value pairs, each key and value preceded by u32 len,
-	 * len includes itself, value may be empty (in which case its len is 4)
+	 * Followed by key/value pairs, each key and value preceded by u32 len,
+	 * len includes itself, value may be empty (in which case its len is 4).
+	 * REVISIT: Non-empty values have one or more u32 items.
 	 */
 };
 
@@ -92,16 +93,18 @@ static void __init unmarshal_key_value_pairs(struct dev_header *dev_header,
 		ucs2_as_utf8(key, ptr + sizeof(key_len),
 			     key_len - sizeof(key_len));
 
+		/* For now only 32-bit values are supported */
 		entry[i].name = key;
 		entry[i].length = val_len - sizeof(val_len);
 		entry[i].is_array = !!entry[i].length;
-		entry[i].pointer.raw_data = ptr + key_len + sizeof(val_len);
+		entry[i].pointer.u32_data = ptr + key_len + sizeof(val_len);
 
 		if (dump_properties) {
 			dev_info(dev, "property: %s\n", entry[i].name);
 			print_hex_dump(KERN_INFO, pr_fmt(), DUMP_PREFIX_OFFSET,
-				16, 1, entry[i].pointer.raw_data,
-				entry[i].length, true);
+				       16, 4,
+				       entry[i].pointer.u32_data, entry[i].length,
+				       true);
 		}
 
 		ptr += key_len + val_len;
-- 
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux