qemu/include
Akihiko Odaki 9dc64bd5a4 util/iov: Do not assert offset is in iov
iov_from_buf(), iov_to_buf(), iov_memset(), and iov_copy() asserts
that the given offset fits in the iov while tolerating the specified
number of bytes to operate with to be greater than the size of iov.
This is inconsistent so remove the assertions.

Asserting the offset fits in the iov makes sense if it is expected that
there are other operations that process the content before the offset
and the content is processed in order. Under this expectation, the
offset should point to the end of bytes that are previously processed
and fit in the iov. However, this expectation depends on the details of
the caller, and did not hold true at least one case and required code to
check iov_size(), which is added with commit 83ddb3dbba
("hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()").

Adding such a check is inefficient and error-prone. These functions
already tolerate the specified number of bytes to operate with to be
greater than the size of iov to avoid such checks so remove the
assertions to tolerate invalid offset as well. They return the number of
bytes they operated with so their callers can still check the returned
value to ensure there are sufficient space at the given offset.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2025-03-10 17:07:16 +08:00
..
accel accel/tcg: Split out getpc.h 2025-03-08 09:34:43 -08:00
authz Prefer 'on' | 'off' over 'yes' | 'no' for bool options 2021-01-29 17:07:53 +00:00
block Generic CPUs / accelerators patch queue 2025-03-07 07:39:49 +08:00
chardev chardev/char-hub: implement backend chardev aggregator 2025-02-03 13:57:08 +04:00
crypto crypto: Remove qcrypto_tls_session_get_handshake_status 2025-02-14 15:19:03 -03:00
disas disas: Fix build against Capstone v6 (again) 2024-11-05 10:09:59 +00:00
exec include/qemu: Tidy atomic128 headers. 2025-03-09 11:45:00 +08:00
fpu fpu: Move m68k_denormal fmt flag into floatx80_behaviour 2025-02-25 15:32:57 +00:00
gdbstub gdbstub/helpers: Introduce ldtul_$endian_p() helpers 2024-10-15 11:55:09 -03:00
hw target-arm queue: 2025-03-08 11:31:41 +08:00
io io: Add a read flag for relaxed EOF 2025-02-14 15:19:04 -03:00
libdecnumber Replace config-time define HOST_WORDS_BIGENDIAN 2022-04-06 10:50:37 +02:00
migration migration: Add save_live_complete_precopy_thread handler 2025-03-06 06:47:33 +01:00
monitor monitor: Remove obsolete stubs 2024-06-30 19:51:44 +03:00
net net: checksum: Convert data to void * 2024-11-25 13:59:50 +08:00
qapi error: define g_autoptr() cleanup function for the Error type 2025-03-06 06:47:33 +01:00
qemu util/iov: Do not assert offset is in iov 2025-03-10 17:07:16 +08:00
qobject qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
qom qom: remove unused field 2025-01-10 23:34:44 +01:00
scsi hw/ufs: Support for UFS logical unit 2023-09-07 14:01:29 -04:00
semihosting semihosting/console: Avoid including 'cpu.h' 2025-01-17 10:44:00 +00:00
standard-headers linux-headers: Update to Linux v6.14-rc3 2025-03-04 15:42:54 +10:00
system system: Open-code qemu_init_arch_modules() using target_name() 2025-03-06 15:46:18 +01:00
tcg tcg: Introduce the 'z' constraint for a hardware zero register 2025-02-18 08:29:03 -08:00
ui ui/input-legacy.c: remove unused legacy qemu_add_kbd_event_handler() function 2024-11-08 11:06:42 +01:00
user user: Introduce host_interrupt_signal 2025-02-10 13:47:59 +00:00
elf.h util: spelling fixes 2023-08-31 19:47:43 +02:00
glib-compat.h Bump minimum glib version to v2.66 2024-05-14 12:46:24 +02:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-main.h ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00