From d759f4aa4b8e660e0745cfed30eb291d9484291d Mon Sep 17 00:00:00 2001 From: Noel Power Date: Wed, 3 Jul 2019 11:10:44 +0000 Subject: [PATCH] lib/util: clang: Fix 'Null pointer passed as an argument' Fixes lib/util/iov_buf.c:50:4: warning: Null pointer passed as an argument to a 'nonnull' parameter <--[clang] memcpy(p, iov[i].iov_base, thislen); ^ 1 warning generated. Signed-off-by: Noel Power Reviewed-by: Gary Lockyer --- lib/util/iov_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util/iov_buf.c b/lib/util/iov_buf.c index 132c7a75637..a9224164068 100644 --- a/lib/util/iov_buf.c +++ b/lib/util/iov_buf.c @@ -46,7 +46,7 @@ ssize_t iov_buf(const struct iovec *iov, int iovcnt, } needed = tmp; - if (needed <= buflen && thislen > 0) { + if ((p != NULL) && needed <= buflen && thislen > 0) { memcpy(p, iov[i].iov_base, thislen); p += thislen; } -- 2.47.3