From 6104f32afc4018632dd425ff1c8349e11a3c7bae Mon Sep 17 00:00:00 2001 From: chao an Date: Wed, 15 Nov 2023 20:55:29 +0800 Subject: [PATCH] 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 --- fs/fat/fs_fat32util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fat/fs_fat32util.c b/fs/fat/fs_fat32util.c index 1831e9fc29..a4a01d2f79 100644 --- a/fs/fat/fs_fat32util.c +++ b/fs/fat/fs_fat32util.c @@ -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 {