align_offset() mixes different widths, and its callers pass both
signed and unsigned values. It's best to stick to unsigned when
twiddling bits.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
block/qcow2.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/qcow2.h b/block/qcow2.h
index 96a8d43..0d7043e 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -468,10 +468,9 @@ static inline int offset_to_l2_index(BDRVQcow2State *s, int64_t offset)
return (offset >> s->cluster_bits) & (s->l2_size - 1);
}
-static inline int64_t align_offset(int64_t offset, int n)
+static inline uint64_t align_offset(uint64_t offset, uint64_t n)
{
- offset = (offset + n - 1) & ~(n - 1);
- return offset;
+ return (offset + n - 1) & ~(n - 1);
}
static inline int64_t qcow2_vm_state_offset(BDRVQcow2State *s)
--
2.7.5