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

bcall 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 6b896f43be Coverity 1497378: Use of 32-bit time_t in CacheVC (#10857)
6b896f43be is described below

commit 6b896f43bef38c42d574d8bc89293766e0dbc94f
Author: Bryan Call <bc...@apache.org>
AuthorDate: Thu Nov 30 08:26:22 2023 -0800

    Coverity 1497378: Use of 32-bit time_t in CacheVC (#10857)
    
    And removed unneeded casting
---
 include/iocore/cache/CacheVC.h | 2 +-
 src/iocore/cache/CacheWrite.cc | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/include/iocore/cache/CacheVC.h b/include/iocore/cache/CacheVC.h
index 84a07609ae..35bc895f3e 100644
--- a/include/iocore/cache/CacheVC.h
+++ b/include/iocore/cache/CacheVC.h
@@ -270,7 +270,7 @@ struct CacheVC : public CacheVConnection {
   Event *trigger;
   CacheKey *read_key;
   ContinuationHandler save_handler;
-  uint32_t pin_in_cache;
+  time_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 536070bdfd..069c0c690c 100644
--- a/src/iocore/cache/CacheWrite.cc
+++ b/src/iocore/cache/CacheWrite.cc
@@ -1591,8 +1591,7 @@ 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;
-  // coverity[Y2K38_SAFETY:FALSE]
-  c->pin_in_cache = static_cast<uint32_t>(apin_in_cache);
+  c->pin_in_cache     = apin_in_cache;
 
   if ((res = c->stripe->open_write_lock(c, false, 1)) > 0) {
     // document currently being written, abort
@@ -1693,8 +1692,7 @@ 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);
-  // coverity[Y2K38_SAFETY:FALSE]
-  c->pin_in_cache = static_cast<uint32_t>(apin_in_cache);
+  c->pin_in_cache = apin_in_cache;
 
   {
     CACHE_TRY_LOCK(lock, c->stripe->mutex, cont->mutex->thread_holding);

Reply via email to