lkml.org 
[lkml]   [2017]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] of/resolver: Replace kmalloc + memcpy with kmemdup()
Date
Save one line.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
---
drivers/of/resolver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 2d58253bf2f7..bd21a66f6930 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -84,10 +84,9 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay,
int offset, len;
int err = 0;

- value = kmalloc(prop_fixup->length, GFP_KERNEL);
+ value = kmemdup(prop_fixup->value, prop_fixup->length, GFP_KERNEL);
if (!value)
return -ENOMEM;
- memcpy(value, prop_fixup->value, prop_fixup->length);

/* prop_fixup contains a list of tuples of path:property_name:offset */
end = value + prop_fixup->length;
--
2.14.GIT
\
 
 \ /
  Last update: 2017-10-13 09:36    [W:0.042 / U:2.104 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site