]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: adding y2k38 annotations to supress coverity issues 54347/head
authorYuval Lifshitz <ylifshit@redhat.com>
Sun, 5 Nov 2023 14:52:30 +0000 (16:52 +0200)
committerYuval Lifshitz <ylifshit@redhat.com>
Sun, 5 Nov 2023 14:52:30 +0000 (16:52 +0200)
the supression comments must be directly above the line
where the issue is.

this is a followup on these commits:
edfb5b9049ee897779863d780bfbaa130a7fbc40
aca2668c88a048ab556c53411dcf2ccd43099d50

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/driver/rados/rgw_trim_datalog.cc
src/rgw/driver/rados/rgw_trim_mdlog.cc
src/rgw/rgw_admin.cc
src/test/cls_lock/test_cls_lock.cc
src/test/cls_log/test_cls_log.cc

index 12adc6fbaa5425755bb4ac137873e3f96ef189ec..bac0cda8dd6477650853d82cbbe80ecbba342a1b 100644 (file)
@@ -224,11 +224,11 @@ int DataLogTrimPollCR::operate(const DoutPrefixProvider *dpp)
       // prevent other gateways from attempting to trim for the duration
       set_status("acquiring trim lock");
 
-      // interval is a small number and unlikely to overflow
-      // coverity[store_truncates_time_t:SUPPRESS]
       yield call(new RGWSimpleRadosLockCR(store->svc()->rados->get_async_processor(), store,
                                           rgw_raw_obj(store->svc()->zone->get_zone_params().log_pool, lock_oid),
                                           "data_trim", lock_cookie,
+                                          // interval is a small number and unlikely to overflow
+                                          // coverity[store_truncates_time_t:SUPPRESS]
                                           interval.sec()));
       if (retcode < 0) {
         // if the lock is already held, go back to sleep and try again later
index d97538f983214f11db3edfa1e12cb4fe2abfd5a2..5a2e07154d28c526871ffd3db676a202562624dd 100644 (file)
@@ -669,10 +669,11 @@ int MetaTrimPollCR::operate(const DoutPrefixProvider *dpp)
       // prevent others from trimming for our entire wait interval
       set_status("acquiring trim lock");
 
-      // interval is a small number and unlikely to overflow
-      // coverity[store_truncates_time_t:SUPPRESS]
       yield call(new RGWSimpleRadosLockCR(store->svc()->rados->get_async_processor(), store,
-                                          obj, name, cookie, interval.sec()));
+                                          obj, name, cookie, 
+                                          // interval is a small number and unlikely to overflow
+                                          // coverity[store_truncates_time_t:SUPPRESS]
+                                          interval.sec()));
       if (retcode < 0) {
         ldout(cct, 4) << "failed to lock: " << cpp_strerror(retcode) << dendl;
         continue;
index 40146293a2c83de220cb07161c7017491b490a06..ecf16abf2cb91d8a551fd61552d16ef135dd7748 100644 (file)
@@ -3039,19 +3039,20 @@ static int scan_totp(CephContext *cct, ceph::real_time& now, rados::cls::otp::ot
   uint32_t max_skew = MAX_TOTP_SKEW_HOURS * 3600;
 
   while (time_ofs_abs < max_skew) {
+    // coverity supression: oath_totp_validate2 is an external library function, cannot fix internally
+    // Further, step_size is a small number and unlikely to overflow
     int rc = oath_totp_validate2(totp.seed_bin.c_str(), totp.seed_bin.length(),
                              start_time, 
+                             // coverity[store_truncates_time_t:SUPPRESS]
                              step_size,
                              time_ofs,
                              1,
                              nullptr,
                              pins[0].c_str());
     if (rc != OATH_INVALID_OTP) {
-      // oath_totp_validate2 is an external library function, cannot fix internally
-      // Further, step_size is a small number and unlikely to overflow
-      // coverity[store_truncates_time_t:SUPPRESS]
       rc = oath_totp_validate2(totp.seed_bin.c_str(), totp.seed_bin.length(),
                                start_time, 
+                               // coverity[store_truncates_time_t:SUPPRESS]
                                step_size,
                                time_ofs - step_size, /* smaller time_ofs moves time forward */
                                1,
index b915de9c2362fa95c51cef1e3c5f2c2f6497ba39..ef543ce8647ca4d41b87d41b4a5df8717536cdb4 100644 (file)
@@ -298,6 +298,7 @@ TEST(ClsLock, TestLockDuration) {
     ASSERT_EQ(-EEXIST, r);
   }
 
+  // coverity[store_truncates_time_t:SUPPRESS]
   sleep(dur.sec());
   ASSERT_EQ(0, l.lock_exclusive(&ioctx, oid));
 
index e8777ac5fedbbc65b8d12c3ebb2ed009630eca01..f8c1a32494a10933560d1b82801ff2534eaec1b6 100644 (file)
@@ -79,6 +79,7 @@ void generate_log(librados::IoCtx& ioctx, string& oid, int max, utime_t& start_t
   int i;
 
   for (i = 0; i < max; i++) {
+    // coverity[store_truncates_time_t:SUPPRESS]
     uint32_t secs = start_time.sec();
     if (modify_time)
       secs += i;
@@ -94,6 +95,7 @@ void generate_log(librados::IoCtx& ioctx, string& oid, int max, utime_t& start_t
 
 utime_t get_time(utime_t& start_time, int i, bool modify_time)
 {
+  // coverity[store_truncates_time_t:SUPPRESS]
   uint32_t secs = start_time.sec();
   if (modify_time)
     secs += i;