summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-helpers.c
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-09-15 11:57:43 +0200
committerVijay Bellur <vbellur@redhat.com>2014-09-19 03:02:47 -0700
commitf32378b660dab5f3f311da8252969a7da16898f4 (patch)
tree5314df4ba69ac7e0e600f867e9e95dbae0759e1a /xlators/cluster/ec/src/ec-helpers.c
parentc788a7784d8526b72714d60bac6e1e09ae985a84 (diff)
ec: Fix some size_t vars to 64 bits even on 32 bits machines
The 64 bits 'trusted.ec.size' extended attribute was incorrectly computed on 32 bits machines due to an overflow on negative numbers. Also changed some potentially dangerous uses of size_t in other places. Change-Id: Id76cfe49a2f350e564b5c71d8c8644fb9ce86662 BUG: 1125312 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8738 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-helpers.c')
-rw-r--r--xlators/cluster/ec/src/ec-helpers.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/cluster/ec/src/ec-helpers.c b/xlators/cluster/ec/src/ec-helpers.c
index 22889337cbc..181a6f7b41a 100644
--- a/xlators/cluster/ec/src/ec-helpers.c
+++ b/xlators/cluster/ec/src/ec-helpers.c
@@ -579,9 +579,9 @@ ec_fd_t * ec_fd_get(fd_t * fd, xlator_t * xl)
return ctx;
}
-size_t ec_adjust_offset(ec_t * ec, off_t * offset, int32_t scale)
+uint32_t ec_adjust_offset(ec_t * ec, off_t * offset, int32_t scale)
{
- size_t head, tmp;
+ off_t head, tmp;
tmp = *offset;
head = tmp % ec->stripe_size;
@@ -596,7 +596,7 @@ size_t ec_adjust_offset(ec_t * ec, off_t * offset, int32_t scale)
return head;
}
-size_t ec_adjust_size(ec_t * ec, size_t size, int32_t scale)
+uint64_t ec_adjust_size(ec_t * ec, uint64_t size, int32_t scale)
{
size += ec->stripe_size - 1;
size -= size % ec->stripe_size;