linux-next/drivers/xen/xenbus
Gustavo A. R. Silva d3a2b6b48f xen/xenbus: Add __counted_by for struct read_buffer and use struct_size()
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for
array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

While there, use struct_size() helper, instead of the open-coded
version, to calculate the size for the allocation of the whole
flexible structure, including of course, the flexible-array member.

This code was found with the help of Coccinelle, and audited and
fixed manually.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
Link: https://lore.kernel.org/r/ZSRMosLuJJS5Y/io@work
Signed-off-by: Juergen Gross <jgross@suse.com>
2023-10-16 15:18:33 +02:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xenbus_client.c xen/xenbus: fix xenbus_setup_ring() 2022-09-16 09:50:47 +02:00
xenbus_comms.c xen: Fix event channel callback via INTX/GSI 2021-01-13 16:12:00 +01:00
xenbus_dev_backend.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xenbus_dev_frontend.c xen/xenbus: Add __counted_by for struct read_buffer and use struct_size() 2023-10-16 15:18:33 +02:00
xenbus_probe_backend.c driver core: make struct bus_type.uevent() take a const * 2023-01-27 13:45:52 +01:00
xenbus_probe_frontend.c xen: xenbus: Use helper function IS_ERR_OR_NULL() 2023-08-21 09:55:11 +02:00
xenbus_probe.c xenbus: fix error exit in xenbus_init() 2023-10-16 15:18:33 +02:00
xenbus_xs.c xen/xenbus: Avoid a lockdep warning when adding a watch 2023-08-22 08:04:59 +02:00
xenbus.h bus: Make remove callback return void 2021-07-21 11:53:42 +02:00