master - dmsetup: check for NULL from dm_task_get_ioctl_timestamp
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e90c5d206043af53e868c785707dabf070fa5747 Commit: e90c5d206043af53e868c785707dabf070fa5747 Parent: 9df3069083cd49f75e0ec54fc1e699b057129934 Author: Zdenek Kabelac <[email protected]> AuthorDate: Sun Nov 8 19:27:22 2015 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Nov 9 10:19:19 2015 +0100
dmsetup: check for NULL from dm_task_get_ioctl_timestamp
Coverity: ensure NULL is not passed to dm_timestamp_delta().
--- tools/dmsetup.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
tools/dmsetup.c +6 -3
@@ -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;