]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.31/device-property-fix-the-length-used-in-property_entry_string.patch
Linux 4.14.108
[thirdparty/kernel/stable-queue.git] / releases / 4.19.31 / device-property-fix-the-length-used-in-property_entry_string.patch
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 include/linux/property.h | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31 --- a/include/linux/property.h
32 +++ b/include/linux/property.h
33 @@ -258,7 +258,7 @@ struct property_entry {
34 #define PROPERTY_ENTRY_STRING(_name_, _val_) \
35 (struct property_entry) { \
36 .name = _name_, \
37 - .length = sizeof(_val_), \
38 + .length = sizeof(const char *), \
39 .type = DEV_PROP_STRING, \
40 { .value = { .str = _val_ } }, \
41 }