From 044be36e333b2ee3bfbacd3e9d54fa68571b13b3 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 31 Dec 2019 16:31:26 -0800 Subject: [PATCH] Micro-optimize __load_ioengine() Instead of copying the I/O engine name, use a pointer to the I/O engine name. This patch suppresses the following false positive Valgrind complaint: Conditional jump or move depends on uninitialised value(s) at 0x41D451: __load_ioengine (ioengines.c:133) by 0x41D451: load_ioengine (ioengines.c:161) by 0x41FA59: ioengine_load (init.c:1126) by 0x423B64: parse_cmd_line (init.c:2670) by 0x4241A3: parse_options (init.c:2965) by 0x40F587: main (fio.c:42) The code for copying I/O engine names was introduced by commit 2866c82d598e ("[PATCH] Separate io engines into separate loadable objects"). Signed-off-by: Bart Van Assche --- ioengines.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ioengines.c b/ioengines.c index 9e3fcc9f..b9200ba9 100644 --- a/ioengines.c +++ b/ioengines.c @@ -121,18 +121,15 @@ static struct ioengine_ops *dlopen_ioengine(struct thread_data *td, return ops; } -static struct ioengine_ops *__load_ioengine(const char *name) +static struct ioengine_ops *__load_ioengine(const char *engine) { - char engine[64]; - - snprintf(engine, sizeof(engine), "%s", name); - /* * linux libaio has alias names, so convert to what we want */ if (!strncmp(engine, "linuxaio", 8)) { - dprint(FD_IO, "converting ioengine name: %s -> libaio\n", name); - strcpy(engine, "libaio"); + dprint(FD_IO, "converting ioengine name: %s -> libaio\n", + engine); + engine = "libaio"; } dprint(FD_IO, "load ioengine %s\n", engine); -- 2.25.1