Whamcloud - gitweb
LU-17000 utils: Initialize 'idgot' time before using 02/55402/2
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 12 Jun 2024 09:35:17 +0000 (05:35 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Jun 2024 03:32:11 +0000 (03:32 +0000)
In case there is an error reading the contents of permission
file. gettimeofday() is correctly not called on 'idgot'.
However, this means that 'idgot' timeval is left uninitialized.
This patch Initialize 'idgot' timeval to 0 so that in case as
above the value is printed as zero and not garbage.

Test-Parameters: trivial
CoverityID: 397122 ("Uninitialized scalar variable")
Fixes: d5b26443 ("LU-16615 utils: add messages in l_getidentity")
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ie3d5dff1f02ede83690472e60cc14c12ec5d978a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55402
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/l_getidentity.c

index 3c76c85..b077b14 100644 (file)
@@ -934,7 +934,7 @@ int main(int argc, char **argv)
        struct identity_downcall_data *data = NULL;
        glob_t path;
        unsigned long uid;
-       struct timeval start, idgot, fini;
+       struct timeval start, idgot = {0}, fini;
        int fd, rc = -EINVAL, size, maxgroups;
        bool alreadyfailed = false;