Skip to content

Commit c7757b9

Browse files
rlubosdanieldegrasse
authored andcommitted
lib: os: zvfs: select: Fix warning about bitshifting signed value
This was caught by UBSAN: zvfs_select.c:70:2: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
1 parent 2d49ef2 commit c7757b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/os/zvfs/zvfs_select.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define FD_SET_CALC_OFFSETS(set, word_idx, bit_mask) { \
2020
unsigned int b_idx = fd % (sizeof(set->bitset[0]) * 8); \
2121
word_idx = fd / (sizeof(set->bitset[0]) * 8); \
22-
bit_mask = 1 << b_idx; \
22+
bit_mask = 1UL << b_idx; \
2323
}
2424

2525
int zvfs_poll_internal(struct zvfs_pollfd *fds, int nfds, k_timeout_t timeout);

0 commit comments

Comments
 (0)