Commit b79c7d68 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Greg Kroah-Hartman
Browse files

RDMA/core: Use size_{add,sub,mul}() in calls to struct_size()



[ Upstream commit 81760bed ]

If, for any reason, the open-coded arithmetic causes a wraparound,
the protection that `struct_size()` provides against potential integer
overflows is defeated. Fix this by hardening calls to `struct_size()`
with `size_add()`, `size_sub()` and `size_mul()`.

Fixes: 467f432a ("RDMA/core: Split port and device counter sysfs attributes")
Fixes: a4676388 ("RDMA/core: Simplify how the gid_attrs sysfs is created")
Fixes: e9dd5daf ("IB/umad: Refactor code to use cdev_device_add()")
Fixes: 324e227e ("RDMA/device: Add ib_device_get_by_netdev()")
Fixes: 5aad26a7 ("IB/core: Use struct_size() in kzalloc()")
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/ZQdt4NsJFwwOYxUR@work


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent a5c83c80
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment