strlen seems to operate in 32-bit chunks, but libmtd sometimes allocates
strings without that much padding. This patch adds something extra to
a string allocation so that the mtd ioengine is clean with respect
to valgrind memory access checks.

Signed-off-by: Dan Ehrenberg <[email protected]>
---
 lib/libmtd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libmtd.c b/lib/libmtd.c
index e1b2be1..5c9eac2 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -55,7 +55,7 @@ static char *mkpath(const char *path, const char *name)
        size_t len1 = strlen(path);
        size_t len2 = strlen(name);
 
-       n = xmalloc(len1 + len2 + 2);
+       n = xmalloc(len1 + len2 + 6);
 
        memcpy(n, path, len1);
        if (n[len1 - 1] != '/')
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to