Skip to content

Commit f08722e

Browse files
authored
Merge pull request ceph#51468 from vedanshbhartia/coverity_time
rgw: Add coverity annotations to ignore warnings about 32 bit time
2 parents 0201269 + aca2668 commit f08722e

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

src/rgw/driver/rados/rgw_trim_datalog.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ int DataLogTrimPollCR::operate(const DoutPrefixProvider *dpp)
223223
// request a 'data_trim' lock that covers the entire wait interval to
224224
// prevent other gateways from attempting to trim for the duration
225225
set_status("acquiring trim lock");
226+
227+
// interval is a small number and unlikely to overflow
228+
// coverity[Y2K38_SAFETY:FALSE]
226229
yield call(new RGWSimpleRadosLockCR(store->svc()->rados->get_async_processor(), store,
227230
rgw_raw_obj(store->svc()->zone->get_zone_params().log_pool, lock_oid),
228231
"data_trim", lock_cookie,

src/rgw/driver/rados/rgw_trim_mdlog.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,9 @@ int MetaTrimPollCR::operate(const DoutPrefixProvider *dpp)
668668

669669
// prevent others from trimming for our entire wait interval
670670
set_status("acquiring trim lock");
671+
672+
// interval is a small number and unlikely to overflow
673+
// coverity[Y2K38_SAFETY:FALSE]
671674
yield call(new RGWSimpleRadosLockCR(store->svc()->rados->get_async_processor(), store,
672675
obj, name, cookie, interval.sec()));
673676
if (retcode < 0) {

src/rgw/rgw_admin.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,9 @@ static int scan_totp(CephContext *cct, ceph::real_time& now, rados::cls::otp::ot
30213021
nullptr,
30223022
pins[0].c_str());
30233023
if (rc != OATH_INVALID_OTP) {
3024+
// oath_totp_validate2 is an external library function, cannot fix internally
3025+
// Further, step_size is a small number and unlikely to overflow
3026+
// coverity[Y2K38_SAFETY:FALSE]
30243027
rc = oath_totp_validate2(totp.seed_bin.c_str(), totp.seed_bin.length(),
30253028
start_time,
30263029
step_size,
@@ -10364,6 +10367,8 @@ int main(int argc, const char **argv)
1036410367
return -ret;
1036510368
}
1036610369

10370+
// time offset is a small number and unlikely to overflow
10371+
// coverity[Y2K38_SAFETY:FALSE]
1036710372
config.time_ofs = time_ofs;
1036810373

1036910374
/* now update the backend */

src/rgw/rgw_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,8 @@ struct RGWBucketEnt {
12931293
void encode(bufferlist& bl) const {
12941294
ENCODE_START(7, 5, bl);
12951295
uint64_t s = size;
1296+
// issue tracked here: https://tracker.ceph.com/issues/61160
1297+
// coverity[Y2K38_SAFETY]
12961298
__u32 mt = ceph::real_clock::to_time_t(creation_time);
12971299
std::string empty_str; // originally had the bucket name here, but we encode bucket later
12981300
encode(empty_str, bl);

src/rgw/rgw_torrent.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ bufferlist RGWPutObj_Torrent::bencode_torrent(std::string_view filename) const
169169

170170
// Only encode create_date and sha1 info. Other fields will be added during
171171
// GetObjectTorrent by rgw_read_torrent_file()
172+
// issue tracked here: https://tracker.ceph.com/issues/61160
173+
// coverity[Y2K38_SAFETY]
172174
bencode(CREATION_DATE, std::time(nullptr), bl);
173175

174176
bencode_key(INFO_PIECES, bl);

0 commit comments

Comments
 (0)