Re: [U-Boot] [PATCH 1/1] net: mvpp2x: add check after calloc

2018-03-07 Thread Joe Hershberger
On Tue, Mar 6, 2018 at 8:39 PM, Heinrich Schuchardt  wrote:
> After allocating plat the pointer is checked.
> Afterwards name is allocated and not checked.
>
> Add the missing check to avoid a possible NULL dereference.
>
> Signed-off-by: Heinrich Schuchardt 

Acked-by: Joe Hershberger 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] net: mvpp2x: add check after calloc

2018-03-06 Thread Heinrich Schuchardt
After allocating plat the pointer is checked.
Afterwards name is allocated and not checked.

Add the missing check to avoid a possible NULL dereference.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/net/mvpp2.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index e3d31a560d..62c0c2be06 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -5598,6 +5598,10 @@ static int mvpp2_base_bind(struct udevice *parent)
id += base_id_add;
 
name = calloc(1, 16);
+   if (!name) {
+   free(plat);
+   return -ENOMEM;
+   }
sprintf(name, "mvpp2-%d", id);
 
/* Create child device UCLASS_ETH and bind it */
-- 
2.14.2

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot