Skip to content
Commit 6d33cabf authored by Kees Cook's avatar Kees Cook Committed by Jason Gunthorpe
Browse files

RDMA/core: Use flexible array for mad data

In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally reading across neighboring array fields.

Without a flexible array, this looks like an attempt to perform a memcpy()
read beyond the end of the packet->mad.data array:

drivers/infiniband/core/user_mad.c:
	memcpy(packet->msg->mad, packet->mad.data, IB_MGMT_MAD_HDR);

Switch from [0] to [] to use the appropriately handled type for trailing
bytes.

Link: https://lore.kernel.org/r/20210616202615.1247242-1-keescook@chromium.org


Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 20ec0a6d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment