1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

dmsetup: check for NULL from dm_task_get_ioctl_timestamp

Coverity: ensure NULL is not passed to dm_timestamp_delta().
This commit is contained in:
Zdenek Kabelac 2015-11-08 19:27:22 +01:00
parent 9df3069083
commit e90c5d2060

View 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;