Skip to content

Commit 822172a

Browse files
authored
coverity 1497413: Use of 32-bit time_t (#9556)
This also fixes 1497354 and 1497378.
1 parent a5b1dd2 commit 822172a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

iocore/cache/CacheWrite.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ Vol::evacuateDocReadDone(int event, Event *e)
680680
if (!b) {
681681
goto Ldone;
682682
}
683-
if ((b->f.pinned && !b->readers) && doc->pinned < static_cast<uint32_t>(Thread::get_hrtime() / HRTIME_SECOND)) {
683+
if ((b->f.pinned && !b->readers) && doc->pinned < static_cast<time_t>(Thread::get_hrtime() / HRTIME_SECOND)) {
684684
goto Ldone;
685685
}
686686

@@ -817,7 +817,7 @@ agg_copy(char *p, CacheVC *vc)
817817
doc->checksum = DOC_NO_CHECKSUM;
818818
if (vc->pin_in_cache) {
819819
dir_set_pinned(&vc->dir, 1);
820-
doc->pinned = static_cast<uint32_t>(Thread::get_hrtime() / HRTIME_SECOND) + vc->pin_in_cache;
820+
doc->pinned = static_cast<time_t>(Thread::get_hrtime() / HRTIME_SECOND) + vc->pin_in_cache;
821821
} else {
822822
dir_set_pinned(&vc->dir, 0);
823823
doc->pinned = 0;
@@ -1720,7 +1720,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheFragType frag_ty
17201720
c->f.overwrite = (options & CACHE_WRITE_OPT_OVERWRITE) != 0;
17211721
c->f.close_complete = (options & CACHE_WRITE_OPT_CLOSE_COMPLETE) != 0;
17221722
c->f.sync = (options & CACHE_WRITE_OPT_SYNC) == CACHE_WRITE_OPT_SYNC;
1723-
c->pin_in_cache = static_cast<uint32_t>(apin_in_cache);
1723+
c->pin_in_cache = apin_in_cache;
17241724

17251725
if ((res = c->vol->open_write_lock(c, false, 1)) > 0) {
17261726
// document currently being written, abort
@@ -1820,7 +1820,7 @@ Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info,
18201820
c->base_stat = cache_write_active_stat;
18211821
}
18221822
CACHE_INCREMENT_DYN_STAT(c->base_stat + CACHE_STAT_ACTIVE);
1823-
c->pin_in_cache = static_cast<uint32_t>(apin_in_cache);
1823+
c->pin_in_cache = apin_in_cache;
18241824

18251825
{
18261826
CACHE_TRY_LOCK(lock, c->vol->mutex, cont->mutex->thread_holding);

iocore/cache/P_CacheInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ struct CacheVC : public CacheVConnection {
465465
Event *trigger;
466466
CacheKey *read_key;
467467
ContinuationHandler save_handler;
468-
uint32_t pin_in_cache;
468+
time_t pin_in_cache;
469469
ink_hrtime start_time;
470470
int base_stat;
471471
int recursive;

iocore/cache/P_CacheVol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ struct Doc {
298298
uint32_t unused : 8; ///< Unused, forced to zero.
299299
uint32_t sync_serial;
300300
uint32_t write_serial;
301-
uint32_t pinned; // pinned until
302301
uint32_t checksum;
302+
time_t pinned; // pinned until
303303
#if TS_ENABLE_FIPS == 1
304304
CryptoHash key; ///< Key for this doc.
305305
#endif

0 commit comments

Comments
 (0)