From: Memphis Date: Wed, 13 May 2015 18:35:29 +0000 (+0200) Subject: - use atomic_dec_u64 for decrementing size counters - this prevents an unsigned wrap... X-Git-Tag: v4.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c74d73cfe5fdab083eb6b474fcdcc9f9fda5351c;p=thirdparty%2Ftvheadend.git - use atomic_dec_u64 for decrementing size counters - this prevents an unsigned wrap because of casting negative parameter to uint64_t - fixes #2712 --- diff --git a/src/timeshift/timeshift_filemgr.c b/src/timeshift/timeshift_filemgr.c index 04c6ea0a7..de4e21f45 100644 --- a/src/timeshift/timeshift_filemgr.c +++ b/src/timeshift/timeshift_filemgr.c @@ -180,9 +180,9 @@ void timeshift_filemgr_remove tvhdebug("timeshift", "ts %d RAM segment remove time %li", ts->id, (long)tsf->time); #endif TAILQ_REMOVE(&ts->files, tsf, link); - atomic_add_u64(×hift_total_size, -tsf->size); + atomic_dec_u64(×hift_total_size, tsf->size); if (tsf->ram) - atomic_add_u64(×hift_total_ram_size, -tsf->size); + atomic_dec_u64(×hift_total_ram_size, tsf->size); timeshift_reaper_remove(tsf); }