From: Dan Ehrenberg Date: Thu, 16 Apr 2015 21:50:39 +0000 (-0700) Subject: Fix mtd valgrind warning X-Git-Tag: fio-2.2.8~35 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;ds=sidebyside;h=51e962a7610f1aa69ffe0374f92774fb83526dc7;hp=4da24b69599f7f78dc1420345f91d90ec0cfe109;p=fio.git Fix mtd valgrind warning 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 Signed-off-by: Jens Axboe --- diff --git a/lib/libmtd.c b/lib/libmtd.c index e1b2be19..5c9eac27 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] != '/')