Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9d48017b authored by Nickolai Zeldovich's avatar Nickolai Zeldovich Committed by Dave Kleikamp
Browse files

jfs: avoid undefined behavior from left-shifting by 32 bits



Shifting a 32-bit int by 32 bits is undefined behavior in C, and
results in different behavior on different architectures (e.g., x86
and PowerPC).  diAlloc() in fs/jfs/jfs_imap.c computes a mask using
0xffffffffu<<(32-bitno), which can left-shift by 32 bits.  To avoid
unexpected behavior, explicitly check for bitno==0 and use a 0 mask.

Signed-off-by: default avatarNickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
parent 5f243b9b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment