aboutsummaryrefslogtreecommitdiff
path: root/docs/sphinx/compat.py
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-04-28 20:11:22 +0900
committerJason Wang <jasowang@redhat.com>2025-03-10 17:07:16 +0800
commit9dc64bd5a4bebdc820e7e8484cb30e02befdc774 (patch)
tree54c580c0a3f5a947f9bd11fd1ff44d86ee893439 /docs/sphinx/compat.py
parente7891c575fb294618b172119a91c892b8f4384a2 (diff)
downloadqemu-9dc64bd5a4bebdc820e7e8484cb30e02befdc774.zip
qemu-9dc64bd5a4bebdc820e7e8484cb30e02befdc774.tar.gz
qemu-9dc64bd5a4bebdc820e7e8484cb30e02befdc774.tar.bz2
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 83ddb3dbba2e ("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>
Diffstat (limited to 'docs/sphinx/compat.py')
0 files changed, 0 insertions, 0 deletions