Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297466 > unrolled thread

[PATCH v2 0/3] device property: post merge fixes

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2015-12-23 14:40 +0100
Last post2015-12-29 12:00 +0100
Articles 15 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/3] device property: post merge fixes Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-23 14:40 +0100
    [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-23 14:40 +0100
      Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-28 03:50 +0100
        Re: [PATCH v2 1/3] device property: add spaces to  PROPERTY_ENTRY_STRING macro Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-28 12:30 +0100
          Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-30 02:20 +0100
            Re: [PATCH v2 1/3] device property: add spaces to  PROPERTY_ENTRY_STRING macro Andrew Morton <akpm@linux-foundation.org> - 2015-12-30 02:30 +0100
              Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-30 02:40 +0100
                Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING  macro Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-12-30 02:50 +0100
                Re: [PATCH v2 1/3] device property: add spaces to  PROPERTY_ENTRY_STRING macro Andrew Morton <akpm@linux-foundation.org> - 2015-12-30 02:50 +0100
                  Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-01 01:30 +0100
            Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING  macro Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-12-30 02:40 +0100
    [PATCH v2 3/3] device property: avoid allocations of 0 length Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-23 14:40 +0100
    [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-23 14:40 +0100
      Re: [PATCH v2 2/3] device property: the secondary fwnode needs to  depend on the primary Heikki Krogerus <heikki.krogerus@linux.intel.com> - 2015-12-29 09:50 +0100
        Re: [PATCH v2 2/3] device property: the secondary fwnode needs to  depend on the primary Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-29 12:00 +0100

#1297466 — [PATCH v2 0/3] device property: post merge fixes

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-12-23 14:40 +0100
Subject[PATCH v2 0/3] device property: post merge fixes
Message-ID<qIRO1-1P2-1@gated-at.bofh.it>
Three fixes to device property API.

Patch 1 is a simple style fix to be folded into previous Andrew's patch to
allow old gcc to build.

There is a crash in linux-next
 BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
 IP: [<ffffffff8145e8a6>] fwnode_property_present+0x16/0x30

Check for fwnode pointer before dereference (patch 2).

Patch 3 prevents to allocate buffers with 0 length (the result maybe surprising
to someone).


Andy Shevchenko (2):
  device property: add spaces to PROPERTY_ENTRY_STRING macro
  device property: avoid allocations of 0 length

Heikki Krogerus (1):
  device property: the secondary fwnode needs to depend on the primary

 drivers/base/property.c  | 14 ++++++++++----
 include/linux/property.h |  2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1297468 — [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-12-23 14:40 +0100
Subject[PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qIRO2-1P2-13@gated-at.bofh.it>
In reply to#1297466
Just a style fix, no functional changes.

To be folded to Andrew's patch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@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 b8c4e42..b51fcd3 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -230,7 +230,7 @@ struct property_entry {
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
-	{ .value = {.str = _val_} },			\
+	{ .value = { .str = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298411 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2015-12-28 03:50 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qKw2L-3Io-55@gated-at.bofh.it>
In reply to#1297468
On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> Just a style fix, no functional changes.
> 
> To be folded to Andrew's patch.

What patch?

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@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 b8c4e42..b51fcd3 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -230,7 +230,7 @@ struct property_entry {
>  	.name = _name_,					\
>  	.length = sizeof(_val_),			\
>  	.is_string = true,				\
> -	{ .value = {.str = _val_} },			\
> +	{ .value = { .str = _val_ } },			\
>  }
>  
>  #define PROPERTY_ENTRY_BOOL(_name_)		\
> 

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298610 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-12-28 12:30 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qKE9Y-1ch-1@gated-at.bofh.it>
In reply to#1298411
On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > Just a style fix, no functional changes.
> > 
> > To be folded to Andrew's patch.
> 
> What patch?

In linux-next from Andrew:

e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4

> 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@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 b8c4e42..b51fcd3 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -230,7 +230,7 @@ struct property_entry {
> >  	.name = _name_,					\
> >  	.length = sizeof(_val_),			\
> >  	.is_string = true,				\
> > -	{ .value = {.str = _val_} },			\
> > +	{ .value = { .str = _val_ } },			\
> >  }
> >  
> >  #define PROPERTY_ENTRY_BOOL(_name_)		\
> > 
> 
> Thanks,
> Rafael
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299188 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2015-12-30 02:20 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLdAK-89y-5@gated-at.bofh.it>
In reply to#1298610
On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
> On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > > Just a style fix, no functional changes.
> > > 
> > > To be folded to Andrew's patch.
> > 
> > What patch?
> 
> In linux-next from Andrew:
> 
> e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
> 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4

Any pointers to the original patch submission(s)?

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299190 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

FromAndrew Morton <akpm@linux-foundation.org>
Date2015-12-30 02:30 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLdKq-8cX-7@gated-at.bofh.it>
In reply to#1299188
On Wed, 30 Dec 2015 02:49:26 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
> > On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> > > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > > > Just a style fix, no functional changes.
> > > > 
> > > > To be folded to Andrew's patch.
> > > 
> > > What patch?
> > 
> > In linux-next from Andrew:
> > 
> > e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
> > 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
> 
> Any pointers to the original patch submission(s)?

I think it was discussed in some followup to something else, I forget.

This:

From: Andrew Morton <akpm@linux-foundation.org>
Subject: include/linux/property.h: fix build issues with gcc-4.4.4

gcc-4.4.4 has problems with initialization of anonymous unions:

drivers/mfd/intel-lpss-acpi.c:30: error: unknown field 'value' specified in initializer

work around this by crafting the initializers in a manner which the
compiler can handle.

Cc: Kevin Fenzi <kevin@scrye.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/property.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -puN include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444 include/linux/property.h
--- a/include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444
+++ a/include/linux/property.h
@@ -175,12 +175,19 @@ struct property_entry {
 	};
 };
 
+/*
+ * Note: the below four initializers for the anonymous union are carefully
+ * crafted to avoid gcc-4.4.4's problems with initialization of anon unions
+ * and structs.
+ */
+
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_)	\
 {								\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(_type_),		\
 	.is_array = true,					\
-	.pointer._type_##_data = _val_,				\
+	.is_string = false,					\
+	{ .pointer = _type_##_data = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_)			\
@@ -198,14 +205,15 @@ struct property_entry {
 	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
 	.is_array = true,					\
 	.is_string = true,					\
-	.pointer.str = _val_,					\
+	{ .pointer = { .str = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_)	\
 {							\
 	.name = _name_,					\
 	.length = sizeof(_type_),			\
-	.value._type_##_data = _val_,			\
+	.is_string = false,				\
+	{ .value = { ._type_##_data = _val_ } },	\
 }
 
 #define PROPERTY_ENTRY_U8(_name_, _val_)		\
@@ -222,7 +230,7 @@ struct property_entry {
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
-	.value.str = _val_,				\
+	{ .value = {.str = _val_} },			\
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299191 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2015-12-30 02:40 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLdU6-8gU-5@gated-at.bofh.it>
In reply to#1299190
On Tuesday, December 29, 2015 05:24:53 PM Andrew Morton wrote:
> On Wed, 30 Dec 2015 02:49:26 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
> 
> > On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
> > > On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
> > > > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
> > > > > Just a style fix, no functional changes.
> > > > > 
> > > > > To be folded to Andrew's patch.
> > > > 
> > > > What patch?
> > > 
> > > In linux-next from Andrew:
> > > 
> > > e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
> > > 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
> > 
> > Any pointers to the original patch submission(s)?
> 
> I think it was discussed in some followup to something else, I forget.
> 
> This:
> 
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: include/linux/property.h: fix build issues with gcc-4.4.4

OK, thanks!

I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
so we have all of that in one place.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299198 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2015-12-30 02:50 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLe3L-8ln-3@gated-at.bofh.it>
In reply to#1299191
On Wed, Dec 30, 2015 at 4:06 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Tuesday, December 29, 2015 05:24:53 PM Andrew Morton wrote:
>> On Wed, 30 Dec 2015 02:49:26 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
>>
>> > On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
>> > > On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
>> > > > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
>> > > > > Just a style fix, no functional changes.
>> > > > >
>> > > > > To be folded to Andrew's patch.
>> > > >
>> > > > What patch?
>> > >
>> > > In linux-next from Andrew:
>> > >
>> > > e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
>> > > 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
>> >
>> > Any pointers to the original patch submission(s)?
>>
>> I think it was discussed in some followup to something else, I forget.
>>
>> This:
>>
>> From: Andrew Morton <akpm@linux-foundation.org>
>> Subject: include/linux/property.h: fix build issues with gcc-4.4.4
>
> OK, thanks!
>
> I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
> so we have all of that in one place.

Be aware that there are actually _two_ patches from Andrew and _one_
from me to be all folded together.
I think there is no need to have 3 of them.

>
> Thanks,
> Rafael
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299200 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

FromAndrew Morton <akpm@linux-foundation.org>
Date2015-12-30 02:50 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLe3L-8ln-9@gated-at.bofh.it>
In reply to#1299191
On Wed, 30 Dec 2015 03:06:23 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:

> I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
> so we have all of that in one place.

That version needed a fix.  Here's the one to apply:


From: Andrew Morton <akpm@linux-foundation.org>
Subject: include/linux/property.h: fix build issues with gcc-4.4.4

gcc-4.4.4 has problems with initialization of anonymous unions:

drivers/mfd/intel-lpss-acpi.c:30: error: unknown field 'value' specified in initializer

work around this by crafting the initializers in a manner which the
compiler can handle.

Cc: Kevin Fenzi <kevin@scrye.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/property.h |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff -puN include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444 include/linux/property.h
--- a/include/linux/property.h~include-linux-propertyh-fix-build-issues-with-gcc-444
+++ a/include/linux/property.h
@@ -175,12 +175,19 @@ struct property_entry {
 	};
 };
 
+/*
+ * Note: the below four initializers for the anonymous union are carefully
+ * crafted to avoid gcc-4.4.4's problems with initialization of anon unions
+ * and structs.
+ */
+
 #define PROPERTY_ENTRY_INTEGER_ARRAY(_name_, _type_, _val_)	\
 {								\
 	.name = _name_,						\
 	.length = ARRAY_SIZE(_val_) * sizeof(_type_),		\
 	.is_array = true,					\
-	.pointer._type_##_data = _val_,				\
+	.is_string = false,					\
+	{ .pointer = { _type_##_data = _val_ } },		\
 }
 
 #define PROPERTY_ENTRY_U8_ARRAY(_name_, _val_)			\
@@ -198,14 +205,15 @@ struct property_entry {
 	.length = ARRAY_SIZE(_val_) * sizeof(const char *),	\
 	.is_array = true,					\
 	.is_string = true,					\
-	.pointer.str = _val_,					\
+	{ .pointer = { .str = _val_ } },			\
 }
 
 #define PROPERTY_ENTRY_INTEGER(_name_, _type_, _val_)	\
 {							\
 	.name = _name_,					\
 	.length = sizeof(_type_),			\
-	.value._type_##_data = _val_,			\
+	.is_string = false,				\
+	{ .value = { ._type_##_data = _val_ } },	\
 }
 
 #define PROPERTY_ENTRY_U8(_name_, _val_)		\
@@ -222,7 +230,7 @@ struct property_entry {
 	.name = _name_,					\
 	.length = sizeof(_val_),			\
 	.is_string = true,				\
-	.value.str = _val_,				\
+	{ .value = {.str = _val_} },			\
 }
 
 #define PROPERTY_ENTRY_BOOL(_name_)		\
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299809 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

From"Rafael J. Wysocki" <rjw@rjwysocki.net>
Date2016-01-01 01:30 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLVLr-2Zt-1@gated-at.bofh.it>
In reply to#1299200
On Tuesday, December 29, 2015 05:44:48 PM Andrew Morton wrote:
> On Wed, 30 Dec 2015 03:06:23 +0100 "Rafael J. Wysocki" <rjw@rjwysocki.net> wrote:
> 
> > I'll apply it to my tree if you don't mind with the Andy's [1/3] on top
> > so we have all of that in one place.
> 
> That version needed a fix.  Here's the one to apply:

OK, thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299192 — Re: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2015-12-30 02:40 +0100
SubjectRe: [PATCH v2 1/3] device property: add spaces to PROPERTY_ENTRY_STRING macro
Message-ID<qLdU5-8gU-1@gated-at.bofh.it>
In reply to#1299188
On Wed, Dec 30, 2015 at 3:49 AM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, December 28, 2015 01:24:13 PM Andy Shevchenko wrote:
>> On Mon, 2015-12-28 at 02:12 +0100, Rafael J. Wysocki wrote:
>> > On Wednesday, December 23, 2015 03:34:42 PM Andy Shevchenko wrote:
>> > > Just a style fix, no functional changes.
>> > >
>> > > To be folded to Andrew's patch.
>> >
>> > What patch?
>>
>> In linux-next from Andrew:
>>
>> e39ece7 include-linux-propertyh-fix-build-issues-with-gcc-444-fix
>> 40bb8a1 include/linux/property.h: fix build issues with gcc-4.4.4
>
> Any pointers to the original patch submission(s)?

Yes, I found one [1] and added to v3 of this patch [2]

[1] http://comments.gmane.org/gmane.linux.kernel.commits.mm/97592
[2] http://www.spinics.net/lists/kernel/msg2151801.html

>
> Thanks,
> Rafael
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1297469 — [PATCH v2 3/3] device property: avoid allocations of 0 length

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-12-23 14:40 +0100
Subject[PATCH v2 3/3] device property: avoid allocations of 0 length
Message-ID<qIRO2-1P2-15@gated-at.bofh.it>
In reply to#1297466
Arrays can not have zero elements by definition of the unified device
properties. If such property comes from outside we should not allow it to pass.
Otherwise memory allocation on 0 length will return non-NULL value, which we
currently don't check.

Prevent memory allocations of 0 length.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/property.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 6c04d18..7e2061b 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -653,6 +653,9 @@ int fwnode_property_match_string(struct fwnode_handle *fwnode,
 	if (nval < 0)
 		return nval;
 
+	if (nval == 0)
+		return -ENODATA;
+
 	values = kcalloc(nval, sizeof(*values), GFP_KERNEL);
 	if (!values)
 		return -ENOMEM;
@@ -718,6 +721,9 @@ static int pset_copy_entry(struct property_entry *dst,
 		return -ENOMEM;
 
 	if (src->is_array) {
+		if (!src->length)
+			return -ENODATA;
+
 		if (src->is_string) {
 			nval = src->length / sizeof(const char *);
 			dst->pointer.str = kcalloc(nval, sizeof(const char *),
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1297470 — [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-12-23 14:40 +0100
Subject[PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary
Message-ID<qIRO2-1P2-21@gated-at.bofh.it>
In reply to#1297466
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

This fixes NULL pointer dereference when the primary fwnode handle
does not exist, for example with PCI devices that do not have ACPI
companion.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/property.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 0b22c8a..6c04d18 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -218,7 +218,7 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
 	bool ret;
 
 	ret = __fwnode_property_present(fwnode, propname);
-	if (ret == false && fwnode->secondary)
+	if (ret == false && fwnode && fwnode->secondary)
 		ret = __fwnode_property_present(fwnode->secondary, propname);
 	return ret;
 }
@@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(device_property_match_string);
 	int _ret_;									\
 	_ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_,		\
 				 _val_, _nval_);					\
-	if (_ret_ == -EINVAL && _fwnode_->secondary)					\
+	if (_ret_ == -EINVAL && fwnode && _fwnode_->secondary)				\
 		_ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_,	\
 				_proptype_, _val_, _nval_);				\
 	_ret_;										\
@@ -593,7 +593,7 @@ int fwnode_property_read_string_array(struct fwnode_handle *fwnode,
 	int ret;
 
 	ret = __fwnode_property_read_string_array(fwnode, propname, val, nval);
-	if (ret == -EINVAL && fwnode->secondary)
+	if (ret == -EINVAL && fwnode && fwnode->secondary)
 		ret = __fwnode_property_read_string_array(fwnode->secondary,
 							  propname, val, nval);
 	return ret;
@@ -621,7 +621,7 @@ int fwnode_property_read_string(struct fwnode_handle *fwnode,
 	int ret;
 
 	ret = __fwnode_property_read_string(fwnode, propname, val);
-	if (ret == -EINVAL && fwnode->secondary)
+	if (ret == -EINVAL && fwnode && fwnode->secondary)
 		ret = __fwnode_property_read_string(fwnode->secondary,
 						    propname, val);
 	return ret;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298911 — Re: [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary

FromHeikki Krogerus <heikki.krogerus@linux.intel.com>
Date2015-12-29 09:50 +0100
SubjectRe: [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary
Message-ID<qKY8F-6qw-7@gated-at.bofh.it>
In reply to#1297470
Hi Andy,

Found a bug from my code..

> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 0b22c8a..6c04d18 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -218,7 +218,7 @@ bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname)
>  	bool ret;
>  
>  	ret = __fwnode_property_present(fwnode, propname);
> -	if (ret == false && fwnode->secondary)
> +	if (ret == false && fwnode && fwnode->secondary)
>  		ret = __fwnode_property_present(fwnode->secondary, propname);
>  	return ret;
>  }
> @@ -423,7 +423,7 @@ EXPORT_SYMBOL_GPL(device_property_match_string);
>  	int _ret_;									\
>  	_ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_, _proptype_,		\
>  				 _val_, _nval_);					\
> -	if (_ret_ == -EINVAL && _fwnode_->secondary)					\
> +	if (_ret_ == -EINVAL && fwnode && _fwnode_->secondary)				\

This should be .._fwnode_ && _fwnode_->secondary)

>  		_ret_ = FWNODE_PROP_READ(_fwnode_->secondary, _propname_, _type_,	\
>  				_proptype_, _val_, _nval_);				\
>  	_ret_;										\


Cheers,

-- 
heikki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298943 — Re: [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2015-12-29 12:00 +0100
SubjectRe: [PATCH v2 2/3] device property: the secondary fwnode needs to depend on the primary
Message-ID<qL0at-7IT-7@gated-at.bofh.it>
In reply to#1298911
On Tue, 2015-12-29 at 10:40 +0200, Heikki Krogerus wrote:
> Hi Andy,
> 
> Found a bug from my code..
> 
> > diff --git a/drivers/base/property.c b/drivers/base/property.c
> > index 0b22c8a..6c04d18 100644
> > --- a/drivers/base/property.c
> > +++ b/drivers/base/property.c
> > @@ -218,7 +218,7 @@ bool fwnode_property_present(struct
> > fwnode_handle *fwnode, const char *propname)
> >  	bool ret;
> >  
> >  	ret = __fwnode_property_present(fwnode, propname);
> > -	if (ret == false && fwnode->secondary)
> > +	if (ret == false && fwnode && fwnode->secondary)
> >  		ret = __fwnode_property_present(fwnode->secondary, 
> > propname);
> >  	return ret;
> >  }
> > @@ -423,7 +423,7 @@
> > EXPORT_SYMBOL_GPL(device_property_match_string);
> >  	int _ret_;							
> > 		\
> >  	_ret_ = FWNODE_PROP_READ(_fwnode_, _propname_, _type_,
> > _proptype_,		\
> >  				 _val_, _nval_);			
> > 		\
> > -	if (_ret_ == -EINVAL && _fwnode_->secondary)		
> > 			\
> > +	if (_ret_ == -EINVAL && fwnode && _fwnode_->secondary)	
> > 			\
> 
> This should be .._fwnode_ && _fwnode_->secondary)

Yeah, we compiled it correctly due to fwnode presents in all
occurrences of this macro.

I will fix and resend a new version.

> 
> >  		_ret_ = FWNODE_PROP_READ(_fwnode_->secondary,
> > _propname_, _type_,	\
> >  				_proptype_, _val_, _nval_);	
> > 			\
> >  	_ret_;							
> > 			\
> 
> 
> Cheers,
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web