This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 9a52506484 Revert "Coverity 1497378: Use of 32-bit time_t in CacheVC 
(#10857)" (#11013)
9a52506484 is described below

commit 9a52506484f0f7c349c987415435874e9deba1e0
Author: Brian Neradt <[email protected]>
AuthorDate: Mon Feb 12 18:40:01 2024 -0600

    Revert "Coverity 1497378: Use of 32-bit time_t in CacheVC (#10857)" (#11013)
    
    On 64 bit systems, time_t (which is an unsigned long) is generally a 64
    bit value. We therefore may not change the type of pin_in_cache from an
    explicit 32 bit value to a 64 bit one without introducing a cache
    inconsistency in ATS 10. Since the community is a hard pass on
    introducing an inconsistency for this release, we have to revert this
    change.
    
    This reverts commit 6b896f43bef38c42d574d8bc89293766e0dbc94f.
    
    Co-authored-by: bneradt <[email protected]>
---
 include/iocore/cache/CacheVC.h | 2 +-
 src/iocore/cache/CacheWrite.cc | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/iocore/cache/CacheVC.h b/include/iocore/cache/CacheVC.h
index 540f027c14..b3044b80d8 100644
--- a/include/iocore/cache/CacheVC.h
+++ b/include/iocore/cache/CacheVC.h
@@ -273,7 +273,7 @@ struct CacheVC : public CacheVConnection {
   Event *trigger;
   CacheKey *read_key;
   ContinuationHandler save_handler;
-  time_t pin_in_cache;
+  uint32_t pin_in_cache;
   ink_hrtime start_time;
   int op_type; // Index into the metrics array for this operation, rather than 
a CacheOpType (fewer casts)
   int recursive;
diff --git a/src/iocore/cache/CacheWrite.cc b/src/iocore/cache/CacheWrite.cc
index f948c5a31f..9810a9eab0 100644
--- a/src/iocore/cache/CacheWrite.cc
+++ b/src/iocore/cache/CacheWrite.cc
@@ -1579,7 +1579,8 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheFragType frag_ty
   c->f.overwrite      = (options & CACHE_WRITE_OPT_OVERWRITE) != 0;
   c->f.close_complete = (options & CACHE_WRITE_OPT_CLOSE_COMPLETE) != 0;
   c->f.sync           = (options & CACHE_WRITE_OPT_SYNC) == 
CACHE_WRITE_OPT_SYNC;
-  c->pin_in_cache     = apin_in_cache;
+  // coverity[Y2K38_SAFETY:FALSE]
+  c->pin_in_cache = static_cast<uint32_t>(apin_in_cache);
 
   if ((res = c->stripe->open_write_lock(c, false, 1)) > 0) {
     // document currently being written, abort
@@ -1680,7 +1681,8 @@ Cache::open_write(Continuation *cont, const CacheKey 
*key, CacheHTTPInfo *info,
 
   Metrics::Gauge::increment(cache_rsb.status[c->op_type].active);
   
Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.status[c->op_type].active);
-  c->pin_in_cache = apin_in_cache;
+  // coverity[Y2K38_SAFETY:FALSE]
+  c->pin_in_cache = static_cast<uint32_t>(apin_in_cache);
 
   {
     CACHE_TRY_LOCK(lock, c->stripe->mutex, cont->mutex->thread_holding);

Reply via email to