Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/tc: fix 32 bits shift for pedit offset calculation
pedit allows setting entire words with an optional mask and OVS makes use of such masks to allow setting fields that do not span entire words. One mask for leading bytes that should not be updated and another mask for trailing bytes that should not be updated. The masks are created using bit shifts. In the case of the mask to omit trailing bytes a right bit shift is used. Currently the code can produce shifts of 1, 2, 3 or 4 bytes (8, 16, 24 or 32 bits) based on the alignment of the end of field being set. However, a shift of 32 bits on a 32bit value is undefined. As it stands the code relies on the result of UINT32_MAX >> 32 being UINT32_MAX. Or in other words a mask that results in the pedit action setting all bytes of the word under operation. This patch adjusts the code to use a shift of 0 for this case, which gives the same result as the undefined behaviour that was relied on, and appears logically correct as the desire is for no trailing bytes (or bits!) to be omitted from the set action. Signed-off-by: Pieter Jansen van Vuuren <[email protected]> Signed-off-by: Simon Horman <[email protected]>
- Loading branch information