]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests/bluestore_types: Fix % 0 in tests
authorAdam Kupczyk <akupczyk@ibm.com>
Fri, 28 Jun 2024 12:16:52 +0000 (12:16 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 7 Aug 2024 10:55:45 +0000 (10:55 +0000)
It was possible to get x % 0. It generated exception.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/test/objectstore/test_bluestore_types.cc

index 535b2fb7c32490259f533234bd44a87f5a14aec9..e8b2054a4fbc182407d2c8a7baf7c9f27eeccfe3 100644 (file)
@@ -2055,7 +2055,7 @@ TEST_P(PunchHoleFixture, multipunch)
     BlueStore::volatile_statfs statfs_delta;
 
     for (int j = 0; j < 10; j++) {
-      uint32_t s = rand() % ((hole_end - hole_start) / 5) + 1;
+      uint32_t s = rand() % ((hole_end - hole_start) / 5 + 1);
       uint32_t p = rand() % (hole_end - hole_start - s) + hole_start;
       store->debug_punch_hole_2(
         coll, onode, p, s,