FAILED: patch "[PATCH] of: fdt: add missing allocation-failure check" failed to apply to 4.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
49e67dd17649b60b4d54966e18ec9c80198227f0Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 17 May 2017 17:29:09 +0200
Subject: [PATCH] of: fdt: add missing allocation-failure check
The memory allocator passed to __unflatten_device_tree() (e.g. a wrapped kzalloc) can fail so add the missing sanity check to avoid dereferencing a NULL pointer.
drivers/of/fdt.c +3 -0
@@ -507,6 +507,9 @@ void *__unflatten_device_tree(const void *blob,/* Allocate memory for the expanded device tree */ mem =dt_alloc (size +4 , __alignof__(struct device_node )); +if (!mem) +return NULL ; +memset (mem,0 , size); *(__be32 *)(mem + size) =cpu_to_be32 (0xdeadbeef );
Rob Herring
maintainerdrivers/of/fdt.c void *__unflatten_device_tree(const void *blob,
Quoted 31 lines · On Mon, May 22, 2017 at 2:17 PM, <[email protected]> wrote:
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
49e67dd17649b60b4d54966e18ec9c80198227f0Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 17 May 2017 17:29:09 +0200
Subject: [PATCH] of: fdt: add missing allocation-failure checkThe memory allocator passed to
__unflatten_device_tree()(e.g. a wrapped kzalloc) can fail so add the missing sanity check to avoid dereferencing a NULL pointer.Fixes fe14042358fa ("of/flattree: Refactor unflatten_device_tree and add fdt_unflatten_tree")Cc stable <[email protected]> # 2.6.38Signed-off-by Johan Hovold <[email protected]>Signed-off-by Rob Herring <[email protected]>drivers/of/fdt.c +0
-0@@ -507,6 +507,9 @@ void *__unflatten_device_tree(const void *blob,
The context looks the same, it's just the line number is 416 in v4.4.
Quoted 10 lines
drivers/of/fdt.c +3
-0/* Allocate memory for the expanded device tree */ mem =dt_alloc (size +4 , __alignof__(struct device_node )); +if (!mem) +return NULL ; +memset (mem,0 , size); *(__be32 *)(mem + size) =cpu_to_be32 (0xdeadbeef );
Greg Kroah-Hartman
maintainerQuoted 27 lines · Rob Herring
Quoted 26 lines · On Mon, May 22, 2017 at 2:17 PM, <[email protected]> wrote:
The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
49e67dd17649b60b4d54966e18ec9c80198227f0Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Wed, 17 May 2017 17:29:09 +0200
Subject: [PATCH] of: fdt: add missing allocation-failure checkThe memory allocator passed to
__unflatten_device_tree()(e.g. a wrapped kzalloc) can fail so add the missing sanity check to avoid dereferencing a NULL pointer.Fixes fe14042358fa ("of/flattree: Refactor unflatten_device_tree and add fdt_unflatten_tree")Cc stable <[email protected]> # 2.6.38Signed-off-by Johan Hovold <[email protected]>Signed-off-by Rob Herring <[email protected]>
Quoted 14 lines
drivers/of/fdt.c void *__unflatten_device_tree(const void *blob,
Quoted 5 lines
drivers/of/fdt.c +0
-0@@ -507,6 +507,9 @@ void *__unflatten_device_tree(const void *blob,The context looks the same, it's just the line number is 416 in v4.4.
Quoted 6 lines
drivers/of/fdt.c +3
-0/* Allocate memory for the expanded device tree */ mem =dt_alloc (size +4 , __alignof__(struct device_node )); +if (!mem) +return NULL ; +
No, in 4.4 this function's return type is "void", not "void *" so the build fails (well, has a warning, which means it isn't correct.)
thanks,
greg k-h