diff options
author | Yuntao Wang <[email protected]> | 2024-05-30 00:06:56 +0800 |
---|---|---|
committer | Christian Brauner <[email protected]> | 2024-05-30 09:11:47 +0200 |
commit | ed8c7fbdfe117abbef81f65428ba263118ef298a (patch) | |
tree | cd0a4971a4bba159285a7a1a3e0a612bc2750037 /lib/test_fortify/write_overflow-strncpy-src.c | |
parent | a82c13d29985a4d99dacd700b497f0c062fe3625 (diff) |
fs/file: fix the check in find_next_fd()
The maximum possible return value of find_next_zero_bit(fdt->full_fds_bits,
maxbit, bitbit) is maxbit. This return value, multiplied by BITS_PER_LONG,
gives the value of bitbit, which can never be greater than maxfd, it can
only be equal to maxfd at most, so the following check 'if (bitbit > maxfd)'
will never be true.
Moreover, when bitbit equals maxfd, it indicates that there are no unused
fds, and the function can directly return.
Fix this check.
Signed-off-by: Yuntao Wang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-strncpy-src.c')
0 files changed, 0 insertions, 0 deletions