Skip to content

Commit cffcec3

Browse files
committed
cls/cas/cls_cas_internal: Initialize 'hash' value before decoding into it
In the decode function for chunk_refs_by_hash_t, initialize the variable 'hash' of type ceph_le32 to zero before its first use. This prevents the variable from containing dirty (uninitialized) values, which could lead to unexpected behavior later in the code. Fixes: https://tracker.ceph.com/issues/64854 Signed-off-by: Nitzan Mordechai <[email protected]>
1 parent d7353ad commit cffcec3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cls/cas/cls_cas_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ struct chunk_refs_by_hash_t : public chunk_refs_t::refs_t {
244244
int hash_bytes = (hash_bits + 7) / 8;
245245
while (n--) {
246246
int64_t poolid;
247-
ceph_le32 hash;
247+
ceph_le32 hash{0};
248248
uint64_t count;
249249
denc_signed_varint(poolid, p);
250250
memcpy(&hash, p.get_pos_add(hash_bytes), hash_bytes);

0 commit comments

Comments
 (0)