Whamcloud - gitweb
libext2fs: fix UBSAN warning in ext2fs_mmp_new_seq()
authorTheodore Ts'o <tytso@mit.edu>
Fri, 22 Jan 2021 04:27:00 +0000 (23:27 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 22 Jan 2021 04:27:00 +0000 (23:27 -0500)
commitc3c41d4ffbdbbce2e7199ece8f76cea0310de820
treea5104cb609a418e38a2edd9237eb81d748fd6f90
parent33b0356c353feaef32fdcf300d39d2d2ef08ef1f
libext2fs: fix UBSAN warning in ext2fs_mmp_new_seq()

Left shifting the pid by 16 bits can cause a UBSAN warning if the pid
is greater than or equal to 2**16.  It doesn't matter since we're just
using the pid to seed for a pseudo-random number generator, but
silence the warning by just swapping the high and low 16 bits of the
pid instead.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/mmp.c