aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-11-11 14:38:12 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-11-11 14:38:12 +1100
commitd04030556db4bb73151172ded3f279882e706dbd (patch)
tree43bbbf5d92f3dc66642bd4c13c281b4638f502e1 /hdata
parent285ac91fa7b3cd4c8834ddb237c521a35adc438f (diff)
downloadskiboot-d04030556db4bb73151172ded3f279882e706dbd.zip
skiboot-d04030556db4bb73151172ded3f279882e706dbd.tar.gz
skiboot-d04030556db4bb73151172ded3f279882e706dbd.tar.bz2
Use VALGRIND callout rather than tricky malloc/memcpy
The tricky memcpy trips up various static analysers and looks rather odd. The more correct thing to do is to ask valgrind to mark it as undefined. There's a call for that, and we depend on valgrind to run the test suite anyway, so we're not introducing a new dependency. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/test/hdata_to_dt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c
index 96c9953..cc7773e 100644
--- a/hdata/test/hdata_to_dt.c
+++ b/hdata/test/hdata_to_dt.c
@@ -25,6 +25,8 @@
#include <interrupts.h>
+#include <valgrind/memcheck.h>
+
struct dt_node *opal_node;
/* Our actual map. */
@@ -130,9 +132,7 @@ static void dump_val(const void *prop, size_t size)
/* Make sure valgrind knows these are undefined bytes. */
static void undefined_bytes(void *p, size_t len)
{
- void *undef = malloc(len);
- memcpy(p, undef, len);
- free(undef);
+ VALGRIND_MAKE_MEM_UNDEFINED(p, len);
}
static void dump_dt(const struct dt_node *root, unsigned indent)