* [PATCH] Fix mtd valgrind warning
@ 2015-04-16 21:50 Dan Ehrenberg
2015-04-16 22:36 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Dan Ehrenberg @ 2015-04-16 21:50 UTC (permalink / raw)
To: fio, axboe; +Cc: gwendal, Dan Ehrenberg
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 <dehrenberg@chromium.org>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix mtd valgrind warning
2015-04-16 21:50 [PATCH] Fix mtd valgrind warning Dan Ehrenberg
@ 2015-04-16 22:36 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-04-16 22:36 UTC (permalink / raw)
To: Dan Ehrenberg, fio; +Cc: gwendal
On 04/16/2015 03:50 PM, Dan Ehrenberg wrote:
> 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.
Thanks, pretty nasty, but after all a small price to pay to get valgrind
to shut up...
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-16 22:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-16 21:50 [PATCH] Fix mtd valgrind warning Dan Ehrenberg
2015-04-16 22:36 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox