]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.108/device-property-fix-the-length-used-in-property_entry_string.patch
Linux 4.14.108
[thirdparty/kernel/stable-queue.git] / releases / 4.14.108 / device-property-fix-the-length-used-in-property_entry_string.patch
CommitLineData
d5b95bcd
GKH
1From 2b6e492467c78183bb629bb0a100ea3509b615a5 Mon Sep 17 00:00:00 2001
2From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
3Date: Wed, 23 Jan 2019 17:44:16 +0300
4Subject: device property: Fix the length used in PROPERTY_ENTRY_STRING()
5
6From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
7
8commit 2b6e492467c78183bb629bb0a100ea3509b615a5 upstream.
9
10With string type property entries we need to use
11sizeof(const char *) instead of the number of characters as
12the length of the entry.
13
14If the string was shorter then sizeof(const char *),
15attempts to read it would have failed with -EOVERFLOW. The
16problem has been hidden because all build-in string
17properties have had a string longer then 8 characters until
18now.
19
20Fixes: a85f42047533 ("device property: helper macros for property entry creation")
21Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
22Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
23Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
24Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
25Signed-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 }