]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iscsi_ibft: Fix UBSAN shift-out-of-bounds warning in ibft_attr_show_nic()
authorChengen Du <chengen.du@canonical.com>
Tue, 14 Jan 2025 04:12:34 +0000 (12:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Mar 2025 19:54:14 +0000 (12:54 -0700)
commitb253660fac5e0e9080d2c95e3a029e1898d49afb
tree00484e457595bc00bd4f4edcf7ca7f63abe3685a
parentaa189c394168ad53d8eacb82a1cc258d2cd90129
iscsi_ibft: Fix UBSAN shift-out-of-bounds warning in ibft_attr_show_nic()

[ Upstream commit 07e0d99a2f701123ad3104c0f1a1e66bce74d6e5 ]

When performing an iSCSI boot using IPv6, iscsistart still reads the
/sys/firmware/ibft/ethernetX/subnet-mask entry. Since the IPv6 prefix
length is 64, this causes the shift exponent to become negative,
triggering a UBSAN warning. As the concept of a subnet mask does not
apply to IPv6, the value is set to ~0 to suppress the warning message.

Signed-off-by: Chengen Du <chengen.du@canonical.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/iscsi_ibft.c