Skip to content

Commit 6cfe56f

Browse files
gagathAl Viro
authored andcommitted
ufs: ufs_sb_private_info: remove unused s_{2,3}apb fields
These two fields are populated and stored as a "frequently used value" in ufs_fill_super, but are not used afterwards in the driver. Moreover, one of the shifts triggers UBSAN: shift-out-of-bounds when apbshift is 12 because 12 * 3 = 36 and 1 << 36 does not fit in the 32 bit integer used to store the value. Closes: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2087853 Signed-off-by: Agathe Porte <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent b57c010 commit 6cfe56f

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

fs/ufs/super.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,11 +1229,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
12291229
else
12301230
uspi->s_apbshift = uspi->s_bshift - 2;
12311231

1232-
uspi->s_2apbshift = uspi->s_apbshift * 2;
1233-
uspi->s_3apbshift = uspi->s_apbshift * 3;
12341232
uspi->s_apb = 1 << uspi->s_apbshift;
1235-
uspi->s_2apb = 1 << uspi->s_2apbshift;
1236-
uspi->s_3apb = 1 << uspi->s_3apbshift;
12371233
uspi->s_apbmask = uspi->s_apb - 1;
12381234
uspi->s_nspfshift = uspi->s_fshift - UFS_SECTOR_BITS;
12391235
uspi->s_nspb = uspi->s_nspf << uspi->s_fpbshift;

fs/ufs/ufs_fs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -775,12 +775,8 @@ struct ufs_sb_private_info {
775775

776776
__u32 s_fpbmask; /* fragments per block mask */
777777
__u32 s_apb; /* address per block */
778-
__u32 s_2apb; /* address per block^2 */
779-
__u32 s_3apb; /* address per block^3 */
780778
__u32 s_apbmask; /* address per block mask */
781779
__u32 s_apbshift; /* address per block shift */
782-
__u32 s_2apbshift; /* address per block shift * 2 */
783-
__u32 s_3apbshift; /* address per block shift * 3 */
784780
__u32 s_nspfshift; /* number of sector per fragment shift */
785781
__u32 s_nspb; /* number of sector per block */
786782
__u32 s_inopf; /* inodes per fragment */

0 commit comments

Comments
 (0)