* [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING
@ 2019-01-23 14:44 Heikki Krogerus
2019-01-25 14:32 ` Andy Shevchenko
[not found] ` <20190126160946.3D3CD218B0@mail.kernel.org>
0 siblings, 2 replies; 5+ messages in thread
From: Heikki Krogerus @ 2019-01-23 14:44 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Andy Shevchenko, linux-kernel, linux-acpi
With string type property entries we need to use
sizeof(const char *) instead of the number of characters as
the length of the entry.
If the string was shorter then sizeof(const char *),
attempts to read it would have failed with -EOVERFLOW. The
problem has been hidden because all build-in string
properties have had a string longer then 8 characters until
now.
Fixes: a85f42047533 ("device property: helper macros for property entry creation")
Cc: stable@vger.kernel.org
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
include/linux/property.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/property.h b/include/linux/property.h
index 3789ec755fb6..65d3420dd5d1 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -258,7 +258,7 @@ struct property_entry {
#define PROPERTY_ENTRY_STRING(_name_, _val_) \
(struct property_entry) { \
.name = _name_, \
- .length = sizeof(_val_), \
+ .length = sizeof(const char *), \
.type = DEV_PROP_STRING, \
{ .value = { .str = _val_ } }, \
}
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING 2019-01-23 14:44 [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING Heikki Krogerus @ 2019-01-25 14:32 ` Andy Shevchenko 2019-01-30 23:57 ` Rafael J. Wysocki [not found] ` <20190126160946.3D3CD218B0@mail.kernel.org> 1 sibling, 1 reply; 5+ messages in thread From: Andy Shevchenko @ 2019-01-25 14:32 UTC (permalink / raw) To: Heikki Krogerus; +Cc: Rafael J. Wysocki, linux-kernel, linux-acpi On Wed, Jan 23, 2019 at 05:44:16PM +0300, Heikki Krogerus wrote: > With string type property entries we need to use > sizeof(const char *) instead of the number of characters as > the length of the entry. > > If the string was shorter then sizeof(const char *), > attempts to read it would have failed with -EOVERFLOW. The > problem has been hidden because all build-in string > properties have had a string longer then 8 characters until > now. > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Fixes: a85f42047533 ("device property: helper macros for property entry creation") > Cc: stable@vger.kernel.org > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > include/linux/property.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/property.h b/include/linux/property.h > index 3789ec755fb6..65d3420dd5d1 100644 > --- a/include/linux/property.h > +++ b/include/linux/property.h > @@ -258,7 +258,7 @@ struct property_entry { > #define PROPERTY_ENTRY_STRING(_name_, _val_) \ > (struct property_entry) { \ > .name = _name_, \ > - .length = sizeof(_val_), \ > + .length = sizeof(const char *), \ > .type = DEV_PROP_STRING, \ > { .value = { .str = _val_ } }, \ > } > -- > 2.20.1 > -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING 2019-01-25 14:32 ` Andy Shevchenko @ 2019-01-30 23:57 ` Rafael J. Wysocki 0 siblings, 0 replies; 5+ messages in thread From: Rafael J. Wysocki @ 2019-01-30 23:57 UTC (permalink / raw) To: Andy Shevchenko, Heikki Krogerus, linux-kernel; +Cc: linux-acpi On Friday, January 25, 2019 3:32:05 PM CET Andy Shevchenko wrote: > On Wed, Jan 23, 2019 at 05:44:16PM +0300, Heikki Krogerus wrote: > > With string type property entries we need to use > > sizeof(const char *) instead of the number of characters as > > the length of the entry. > > > > If the string was shorter then sizeof(const char *), > > attempts to read it would have failed with -EOVERFLOW. The > > problem has been hidden because all build-in string > > properties have had a string longer then 8 characters until > > now. > > > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > Fixes: a85f42047533 ("device property: helper macros for property entry creation") > > Cc: stable@vger.kernel.org > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > > --- > > include/linux/property.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/include/linux/property.h b/include/linux/property.h > > index 3789ec755fb6..65d3420dd5d1 100644 > > --- a/include/linux/property.h > > +++ b/include/linux/property.h > > @@ -258,7 +258,7 @@ struct property_entry { > > #define PROPERTY_ENTRY_STRING(_name_, _val_) \ > > (struct property_entry) { \ > > .name = _name_, \ > > - .length = sizeof(_val_), \ > > + .length = sizeof(const char *), \ > > .type = DEV_PROP_STRING, \ > > { .value = { .str = _val_ } }, \ > > } > > Patch applied, thanks! ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20190126160946.3D3CD218B0@mail.kernel.org>]
* Re: [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING [not found] ` <20190126160946.3D3CD218B0@mail.kernel.org> @ 2019-01-28 9:07 ` Heikki Krogerus 2019-03-20 20:20 ` Greg KH 0 siblings, 1 reply; 5+ messages in thread From: Heikki Krogerus @ 2019-01-28 9:07 UTC (permalink / raw) To: Sasha Levin; +Cc: Rafael J. Wysocki, Andy Shevchenko, stable [-- Attachment #1: Type: text/plain, Size: 2577 bytes --] On Sat, Jan 26, 2019 at 04:09:45PM +0000, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a "Fixes:" tag, > fixing commit: a85f42047533 device property: helper macros for property entry creation. > > The bot has tested the following trees: v4.20.4, v4.19.17, v4.14.95, v4.9.152. > > v4.20.4: Build OK! > v4.19.17: Build OK! > v4.14.95: Failed to apply! Possible dependencies: > 63dcc7090137 ("device property: Get rid of union aliasing") > 6e98503dba64 ("efi/apple-properties: Remove redundant attribute initialization from unmarshal_key_value_pairs()") > b2ca8bdff60c ("device property: Reuse property_entry_free_data()") > d5f962fa269e ("device property: Move property_entry_free_data() upper") > > v4.9.152: Failed to apply! Possible dependencies: > 027b25b26447 ("ACPI: Add FWNODE_ACPI_STATIC fwnode type") > 07bb80d40b0e ("device property: Add support for remote endpoints") > 0f194992c85f ("device property: Fix reading pset strings using array access functions") > 1df09bc66f9b ("of: Move OF property and graph API from base.c to property.c") > 21ea73f54c6d ("device property: Add fwnode_get_named_child_node()") > 2475a2b6c877 ("drivers/of/base.c: Add of_property_read_u64_index") > 2bd5452d46df ("device property: Add support for fwnode endpoints") > 34055190b19d ("ACPI / property: Add fwnode_get_next_child_node()") > 3708184afc77 ("device property: Move FW type specific functionality to FW specific files") > 39e5aeed835d ("device property: Constify argument to pset fwnode backend") > 3b27d00e7b6d ("device property: Move fwnode graph ops to firmware specific locations") > 5fa23530d4fc ("of: base: add support to find the level of the last cache") > 63dcc7090137 ("device property: Get rid of union aliasing") > 79389a83bc38 ("ACPI / property: Add support for remote endpoints") > 99db5ff7fe0b ("ACPI / property: Hierarchical properties support update") > afaf26fd8458 ("device property: Add fwnode_get_parent()") > b85ad494098b ("of: introduce of_graph_get_remote_node") > bec84da8d1da ("device property: allow to constify properties") > db3e50f3234b ("device property: Get rid of struct fwnode_handle type field") > dfa672fbc0d9 ("ACPI / property: Add possiblity to retrieve parent firmware node") > e7887c284969 ("device property: Add fwnode_handle_get()") > > > How should we proceed with this patch? Can we use the attached separate patches with v4.9 and v4.14 ? thanks, -- heikki [-- Attachment #2: for_v4.9.x.patch --] [-- Type: text/plain, Size: 1341 bytes --] From 6bd60b922b1f1e43fd534a11194553f27c036a1e Mon Sep 17 00:00:00 2001 From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: Wed, 23 Jan 2019 17:16:47 +0300 Subject: [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING With string type property entries we need to use sizeof(const char *) instead of the number of characters as the length of the entry. If the string was shorter then sizeof(const char *), attempts to read it would have failed with -EOVERFLOW. The problem has been hidden because all build-in string properties have had a string longer then 8 characters until now. Fixes: a85f42047533 ("device property: helper macros for property entry creation") Cc: stable@vger.kernel.org # 4.9.x Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- include/linux/property.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/property.h b/include/linux/property.h index 459337fb44d0..d5c7ebda4113 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -233,7 +233,7 @@ struct property_entry { #define PROPERTY_ENTRY_STRING(_name_, _val_) \ (struct property_entry) { \ .name = _name_, \ - .length = sizeof(_val_), \ + .length = sizeof(const char *), \ .is_string = true, \ { .value = { .str = _val_ } }, \ } -- 2.20.1 [-- Attachment #3: for_v4.14.x.patch --] [-- Type: text/plain, Size: 1342 bytes --] From 9ebe90b6f12d4107e8b7c3949a924486d311e28f Mon Sep 17 00:00:00 2001 From: Heikki Krogerus <heikki.krogerus@linux.intel.com> Date: Wed, 23 Jan 2019 17:16:47 +0300 Subject: [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING With string type property entries we need to use sizeof(const char *) instead of the number of characters as the length of the entry. If the string was shorter then sizeof(const char *), attempts to read it would have failed with -EOVERFLOW. The problem has been hidden because all build-in string properties have had a string longer then 8 characters until now. Fixes: a85f42047533 ("device property: helper macros for property entry creation") Cc: stable@vger.kernel.org # 4.14.x Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- include/linux/property.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/property.h b/include/linux/property.h index 89d94b349912..45777ec1c524 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -252,7 +252,7 @@ struct property_entry { #define PROPERTY_ENTRY_STRING(_name_, _val_) \ (struct property_entry) { \ .name = _name_, \ - .length = sizeof(_val_), \ + .length = sizeof(const char *), \ .is_string = true, \ { .value = { .str = _val_ } }, \ } -- 2.20.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING 2019-01-28 9:07 ` Heikki Krogerus @ 2019-03-20 20:20 ` Greg KH 0 siblings, 0 replies; 5+ messages in thread From: Greg KH @ 2019-03-20 20:20 UTC (permalink / raw) To: Heikki Krogerus; +Cc: Sasha Levin, Rafael J. Wysocki, Andy Shevchenko, stable On Mon, Jan 28, 2019 at 11:07:24AM +0200, Heikki Krogerus wrote: > On Sat, Jan 26, 2019 at 04:09:45PM +0000, Sasha Levin wrote: > > Hi, > > > > [This is an automated email] > > > > This commit has been processed because it contains a "Fixes:" tag, > > fixing commit: a85f42047533 device property: helper macros for property entry creation. > > > > The bot has tested the following trees: v4.20.4, v4.19.17, v4.14.95, v4.9.152. > > > > v4.20.4: Build OK! > > v4.19.17: Build OK! > > v4.14.95: Failed to apply! Possible dependencies: > > 63dcc7090137 ("device property: Get rid of union aliasing") > > 6e98503dba64 ("efi/apple-properties: Remove redundant attribute initialization from unmarshal_key_value_pairs()") > > b2ca8bdff60c ("device property: Reuse property_entry_free_data()") > > d5f962fa269e ("device property: Move property_entry_free_data() upper") > > > > v4.9.152: Failed to apply! Possible dependencies: > > 027b25b26447 ("ACPI: Add FWNODE_ACPI_STATIC fwnode type") > > 07bb80d40b0e ("device property: Add support for remote endpoints") > > 0f194992c85f ("device property: Fix reading pset strings using array access functions") > > 1df09bc66f9b ("of: Move OF property and graph API from base.c to property.c") > > 21ea73f54c6d ("device property: Add fwnode_get_named_child_node()") > > 2475a2b6c877 ("drivers/of/base.c: Add of_property_read_u64_index") > > 2bd5452d46df ("device property: Add support for fwnode endpoints") > > 34055190b19d ("ACPI / property: Add fwnode_get_next_child_node()") > > 3708184afc77 ("device property: Move FW type specific functionality to FW specific files") > > 39e5aeed835d ("device property: Constify argument to pset fwnode backend") > > 3b27d00e7b6d ("device property: Move fwnode graph ops to firmware specific locations") > > 5fa23530d4fc ("of: base: add support to find the level of the last cache") > > 63dcc7090137 ("device property: Get rid of union aliasing") > > 79389a83bc38 ("ACPI / property: Add support for remote endpoints") > > 99db5ff7fe0b ("ACPI / property: Hierarchical properties support update") > > afaf26fd8458 ("device property: Add fwnode_get_parent()") > > b85ad494098b ("of: introduce of_graph_get_remote_node") > > bec84da8d1da ("device property: allow to constify properties") > > db3e50f3234b ("device property: Get rid of struct fwnode_handle type field") > > dfa672fbc0d9 ("ACPI / property: Add possiblity to retrieve parent firmware node") > > e7887c284969 ("device property: Add fwnode_handle_get()") > > > > > > How should we proceed with this patch? > > Can we use the attached separate patches with v4.9 and v4.14 ? That worked, thanks! greg k-h ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-20 20:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23 14:44 [PATCH] device property: Fix the length used in PROPERTY_ENTRY_STRING Heikki Krogerus
2019-01-25 14:32 ` Andy Shevchenko
2019-01-30 23:57 ` Rafael J. Wysocki
[not found] ` <20190126160946.3D3CD218B0@mail.kernel.org>
2019-01-28 9:07 ` Heikki Krogerus
2019-03-20 20:20 ` Greg KH
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.