Skip to content

Commit 922983c

Browse files
committed
IB/uverbs: Fix reading of 32 bit flags
This is missing a zeroing of the high bits of flags, and is also not correct for big endian machines. Properly zero extend the 32 bit flags into the 64 bit stack variable. Reported-by: Michael J. Ruhl <[email protected]> Fixes: bccd062 ("IB/uverbs: Add UVERBS_ATTR_FLAGS_IN to the specs language") Signed-off-by: Jason Gunthorpe <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Reviewed-by: Michael J. Ruhl <[email protected]>
1 parent 61b717d commit 922983c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/core/uverbs_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ int uverbs_get_flags64(u64 *to, const struct uverbs_attr_bundle *attrs_bundle,
535535
if (attr->ptr_attr.len == 8)
536536
flags = attr->ptr_attr.data;
537537
else if (attr->ptr_attr.len == 4)
538-
memcpy(&flags, &attr->ptr_attr.data, 4);
538+
flags = *(u32 *)&attr->ptr_attr.data;
539539
else
540540
return -EINVAL;
541541

0 commit comments

Comments
 (0)