]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Keep valgrind happy when mixing sscanf and strtok
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 23 Nov 2011 19:52:48 +0000 (17:52 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Wed, 23 Nov 2011 19:52:48 +0000 (17:52 -0200)
When mixing sscanf() and strtok() Valgrind complaints like below:

==1641== Conditional jump or move depends on uninitialised value(s)

Use stroull() instead of sscanf().

libkmod/libkmod-loaded.c

index af55386f3051e0e1d5da4dc4592f19c7163c7916..7698af9db06768cbbba6ad1bff19e0c86c501f49 100644 (file)
@@ -163,7 +163,7 @@ static int loaded_modules_parse(struct kmod_loaded *mod,
                if (tok == NULL)
                        goto done;
 
-               sscanf(tok, "%" SCNxPTR, &m->addr);
+               m->addr = strtoull(tok, NULL, 16);
 
 done:
                l = kmod_list_append(l, m);