]>
Commit | Line | Data |
---|---|---|
d5b95bcd GKH |
1 | From 2b6e492467c78183bb629bb0a100ea3509b615a5 Mon Sep 17 00:00:00 2001 |
2 | From: Heikki Krogerus <heikki.krogerus@linux.intel.com> | |
3 | Date: Wed, 23 Jan 2019 17:44:16 +0300 | |
4 | Subject: device property: Fix the length used in PROPERTY_ENTRY_STRING() | |
5 | ||
6 | From: Heikki Krogerus <heikki.krogerus@linux.intel.com> | |
7 | ||
8 | commit 2b6e492467c78183bb629bb0a100ea3509b615a5 upstream. | |
9 | ||
10 | With string type property entries we need to use | |
11 | sizeof(const char *) instead of the number of characters as | |
12 | the length of the entry. | |
13 | ||
14 | If the string was shorter then sizeof(const char *), | |
15 | attempts to read it would have failed with -EOVERFLOW. The | |
16 | problem has been hidden because all build-in string | |
17 | properties have had a string longer then 8 characters until | |
18 | now. | |
19 | ||
20 | Fixes: a85f42047533 ("device property: helper macros for property entry creation") | |
21 | Cc: 4.5+ <stable@vger.kernel.org> # 4.5+ | |
22 | Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> | |
23 | Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> | |
24 | Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | |
25 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
26 | ||
27 | ||
28 | --- | |
29 | include/linux/property.h | 2 +- | |
30 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
31 | ||
32 | --- a/include/linux/property.h | |
33 | +++ b/include/linux/property.h | |
34 | @@ -252,7 +252,7 @@ struct property_entry { | |
35 | #define PROPERTY_ENTRY_STRING(_name_, _val_) \ | |
36 | (struct property_entry) { \ | |
37 | .name = _name_, \ | |
38 | - .length = sizeof(_val_), \ | |
39 | + .length = sizeof(const char *), \ | |
40 | .is_string = true, \ | |
41 | { .value = { .str = _val_ } }, \ | |
42 | } |