On 14/04/2025 04:19, David Gibson wrote:
On Fri, Apr 11, 2025 at 03:10:13PM +0200, Laurent Vivier wrote:
Provide a temporary variable of the wanted type to store the header if the memory in the iovec array is not contiguous.
Signed-off-by: Laurent Vivier
--- iov.c | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- iov.h | 52 ++++++++++++++++++++++++++++++++++++++-------------- tcp_buf.c | 2 +- 3 files changed, 83 insertions(+), 24 deletions(-) diff --git a/iov.c b/iov.c index d2aca59e42ed..ae8eca26f295 100644 --- a/iov.c +++ b/iov.c @@ -108,7 +108,7 @@ size_t iov_from_buf(const struct iovec *iov, size_t iov_cnt, * * Returns: The number of bytes successfully copied. */ -/* cppcheck-suppress unusedFunction */ +/* cppcheck-suppress [staticFunction] */ size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt, size_t offset, void *buf, size_t bytes) { @@ -126,6 +126,7 @@ size_t iov_to_buf(const struct iovec *iov, size_t iov_cnt, /* copying data */ for (copied = 0; copied < bytes && i < iov_cnt; i++) { size_t len = MIN(iov[i].iov_len - offset, bytes - copied); + /* NOLINTNEXTLINE(clang-analyzer-core.NonNullParamChecker) */
It's not clear to me why this extra lint suppression is needed. Is it related to the changes in this patch, or is it an unrelated fix?
Actually, I don't know. The warning appears when I add the iov_to_buf() call in iov_peek_header_() and I don't understand why. For me it's a false positive. Thanks, Laurent