[PATCH] isofs: fix undefined behavior in iso_date()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Linke Li <lilinke99@xxxxxxxxx>

Fix undefined behavior in the code by properly handling the left shift operaion.
Instead of left-shifting a negative value, explicitly cast -1 to an unsigned int
before the shift. This ensures well defined behavior and resolves any potential
issues.

Signed-off-by: Linke Li <lilinke99@xxxxxxxxx>
---
 fs/isofs/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/isofs/util.c b/fs/isofs/util.c
index e88dba721661..4c902901401a 100644
--- a/fs/isofs/util.c
+++ b/fs/isofs/util.c
@@ -37,7 +37,7 @@ int iso_date(u8 *p, int flag)
 
 		/* sign extend */
 		if (tz & 0x80)
-			tz |= (-1 << 8);
+			tz |= ((unsigned int)-1 << 8);
 		
 		/* 
 		 * The timezone offset is unreliable on some disks,
-- 
2.25.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux