With 'bytes(__u32)' being 32, a left-shift of 31 may happen which is undefined for the signed 32-bit value 1. Avoid this by declaring 1 as unsigned.
Showing the changes to include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -41,19 +41,19 @@ struct xt_sctp_info { · 40 unmodified lines | |||
| 41 | #define SCTP_CHUNKMAP_SET(chunkmap, type) \ | 41 | #define SCTP_CHUNKMAP_SET(chunkmap, type) \ |
| 42 | do { \ | 42 | do { \ |
| 43 | (chunkmap)[type / bytes(__u32)] |= \ | 43 | (chunkmap)[type / bytes(__u32)] |= \ |
| 44 | 1 << (type % bytes(__u32)); \ | 44 | 1u << (type % bytes(__u32)); \ |
| 45 | } while (0) | 45 | } while (0) |
| 46 | 46 | ||
| 47 | #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ | 47 | #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ |
| 48 | do { \ | 48 | do { \ |
| 49 | (chunkmap)[type / bytes(__u32)] &= \ | 49 | (chunkmap)[type / bytes(__u32)] &= \ |
| 50 | ~(1 << (type % bytes(__u32))); \ | 50 | ~(1u << (type % bytes(__u32))); \ |
| 51 | } while (0) | 51 | } while (0) |
| 52 | 52 | ||
| 53 | #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ | 53 | #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ |
| 54 | ({ \ | 54 | ({ \ |
| 55 | ((chunkmap)[type / bytes (__u32)] & \ | 55 | ((chunkmap)[type / bytes (__u32)] & \ |
| 56 | (1 << (type % bytes (__u32)))) ? 1: 0; \ | 56 | (1u << (type % bytes (__u32)))) ? 1: 0; \ |
| 57 | }) | 57 | }) |
| 58 | 58 | ||
| 59 | #define SCTP_CHUNKMAP_RESET(chunkmap) \ | 59 | #define SCTP_CHUNKMAP_RESET(chunkmap) \ |