fs/fat: fix ubsan warning of shift-out-of-bounds

ubsan_prologue: ================================================================================
ubsan_prologue: UBSAN: shift-out-of-bounds in fat/fs_fat32util.c:989:40
__ubsan_handle_shift_out_of_bounds: left shift of 268435455 by 4 places cannot be represented in type 'int'
ubsan_epilogue: ================================================================================

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an 2023-11-15 20:55:29 +08:00 committed by Xiang Xiao
parent 61aa2c36b6
commit 6104f32afc

View File

@ -986,7 +986,7 @@ int fat_putcluster(struct fat_mountpt_s *fs, uint32_t clusterno,
/* Save the LS four bits of the next cluster */
value = (fs->fs_buffer[fatindex] & 0x0f) |
nextcluster << 4;
(uint8_t)nextcluster << 4;
}
else
{