]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libuuid: ensure variable is initialized [cppcheck]
authorSami Kerola <kerolasa@iki.fi>
Sat, 29 Feb 2020 08:51:53 +0000 (08:51 +0000)
committerSami Kerola <kerolasa@iki.fi>
Sun, 29 Mar 2020 19:19:11 +0000 (20:19 +0100)
commit3c92864ecd755286b8a743d8ac3388e67ae8598c
treec35843a4b838f6bbc86ff0d130c378824c308eb7
parentdcb87944c28105fcd718625d9477c3518d26875b
libuuid: ensure variable is initialized [cppcheck]

This fix has a little bit of a feel of making a static analyzer to be happy
instead of real progress.  If I read the preprocessor directives correctly
it should be impossible hit uninitialized variable.  Then again if a bug
creeps into these ifdef's in that case it is nice to have robust code that
doesn't immediately go wrong.

    libuuid/src/gen_uuid.c:200:20: error: Uninitialized variable: a [uninitvar]
       memcpy(node_id, a, 6);
                       ^
    libuuid/src/gen_uuid.c:197:8: error: Uninitialized variable: a [uninitvar]
      if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
           ^

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
libuuid/src/gen_uuid.c