From 2f524f039db0b9239e32668b21258ef4e60ae01b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 7 Feb 2016 17:37:00 +0100 Subject: [PATCH] attribute: Avoid shifting 32 bit integers. att_logical_or() is called from com_check() to set up a bitmask where a bit is set if and only if it corresponds to an existing attribute. Doing "1 << i" is wrong in this context because the constant "1" is a (signed) 32 bit quantity and we need to be able to shift by more than 31 bits for the attribute mask. Fix this by using an uint64_t variable instead. --- attribute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attribute.c b/attribute.c index f3f8ea7a..4cb29828 100644 --- a/attribute.c +++ b/attribute.c @@ -437,13 +437,13 @@ err: static int att_logical_or(struct osl_row *row, void *data) { - uint64_t *att_mask = data; + uint64_t *att_mask = data, one = 1; struct osl_object bitnum_obj; int ret = osl_get_object(attribute_table, row, ATTCOL_BITNUM, &bitnum_obj); if (ret < 0) return ret; - *att_mask |= 1 << *(unsigned char *)bitnum_obj.data; + *att_mask |= one << *(unsigned char *)bitnum_obj.data; return 0; } -- 2.39.2