]> sourceware.org Git - lvm2.git/commitdiff
dmsetup: check for NULL from dm_task_get_ioctl_timestamp
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 8 Nov 2015 18:27:22 +0000 (19:27 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 9 Nov 2015 09:19:19 +0000 (10:19 +0100)
Coverity: ensure NULL is not passed to dm_timestamp_delta().

tools/dmsetup.c

index 036f58c01007f40712e505f619d3ee95d21a9271..a5cbef5bbd36a00ff04b7c4b117e04bb3e65f389 100644 (file)
@@ -401,15 +401,18 @@ static int _task_run(struct dm_task *dmt)
 {
        int r;
        uint64_t delta;
+       struct dm_timestamp *ts;
 
        if (_initial_timestamp)
                dm_task_set_record_timestamp(dmt);
 
        r = dm_task_run(dmt);
 
-       if (_initial_timestamp) {
-               delta = dm_timestamp_delta(dm_task_get_ioctl_timestamp(dmt), _initial_timestamp);
-               log_debug("Timestamp: %7" PRIu64 ".%09" PRIu64 " seconds", delta / NSEC_PER_SEC, delta % NSEC_PER_SEC);
+       if (_initial_timestamp &&
+           (ts = dm_task_get_ioctl_timestamp(dmt))) {
+               delta = dm_timestamp_delta(ts, _initial_timestamp);
+               log_debug("Timestamp: %7" PRIu64 ".%09" PRIu64 " seconds",
+                         delta / NSEC_PER_SEC, delta % NSEC_PER_SEC);
        }
 
        return r;
This page took 0.046738 seconds and 5 git commands to generate.