Commit 748d1b8 adds the fixup feature to the above command. With this commit an unwanted free(data) on the freshly set property value is done if someone tries to set the value of an already present property (not the case for a new property). Furthermore in fixup mode the pointer fixup->data is freed when the fixup function is called more than once. This leads to a hanging system after calling of_dump -F many times. Fix this issues by copying the data to a new allocated memory area like a new property is created. Signed-off-by: Oleg Karfich <oleg.karfich@xxxxxxxx> --- Changes in v2: - slightly different solution like in [1] - consider memory leak when a new property is created. Noted in [2] - also consider hanging system when oftree -F is used [1] http://lists.infradead.org/pipermail/barebox/2018-August/034444.html [2] http://lists.infradead.org/pipermail/barebox/2018-August/034446.html --- commands/of_property.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/commands/of_property.c b/commands/of_property.c index d0b923f..31e9b71 100644 --- a/commands/of_property.c +++ b/commands/of_property.c @@ -270,9 +270,8 @@ static int do_of_property_set_now(struct device_node *root, const char *path, free(pp->value); pp->value_const = NULL; - /* limit property data to the actual size */ if (len) - pp->value = xrealloc(data, len); + pp->value = xmemdup(data, len); else pp->value = NULL; -- 2.7.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox