Skip to content

Commit

Permalink
IB/uverbs: Fix reading of 32 bit flags
Browse files Browse the repository at this point in the history
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 <michael.j.ruhl@intel.com>
Fixes: bccd062 ("IB/uverbs: Add UVERBS_ATTR_FLAGS_IN to the specs language")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
  • Loading branch information
Jason Gunthorpe committed Aug 9, 2018
1 parent 61b717d commit 922983c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/core/uverbs_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ int uverbs_get_flags64(u64 *to, const struct uverbs_attr_bundle *attrs_bundle,
if (attr->ptr_attr.len == 8)
flags = attr->ptr_attr.data;
else if (attr->ptr_attr.len == 4)
memcpy(&flags, &attr->ptr_attr.data, 4);
flags = *(u32 *)&attr->ptr_attr.data;
else
return -EINVAL;

Expand Down

0 comments on commit 922983c

Please sign in to comment.