Skip to content

Commit

Permalink
Merge tag 'lsm-pr-20221107' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/pcmoore/lsm

Pull lsm fix from Paul Moore:
 "A small capability patch to fix an instance of undefined behavior in a
  shift operator caused when shifting a signed value too far.

  While the fix is trivial and I can't imagine it causing a problem in a
  backport, I'm not explicitly marking it for stable on the off chance
  that there is some system out there which is relying on some wonky
  unexpected behavior which this patch could break; *if* it does break,
  IMO it's better that to happen in a minor or -rcX release and not in a
  stable backport"

* tag 'lsm-pr-20221107' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
  capabilities: fix undefined behavior in bit shift for CAP_TO_MASK
  • Loading branch information
Linus Torvalds committed Nov 8, 2022
2 parents 59f2f4b + 4665397 commit f49b2d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/uapi/linux/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ struct vfs_ns_cap_data {
*/

#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */
#define CAP_TO_MASK(x) (1U << ((x) & 31)) /* mask for indexed __u32 */


#endif /* _UAPI_LINUX_CAPABILITY_H */

0 comments on commit f49b2d8

Please sign in to comment.