From 589bb918ef39058b1f06da72092e895835a7aaff Mon Sep 17 00:00:00 2001 From: Giuseppe Di Natale Date: Thu, 9 Mar 2017 17:40:21 -0800 Subject: [PATCH] Suppress cppcheck nullPointer error in zfs_write Newer versions of cppcheck find the potential NULL pointer bug in zfs_write(). The function is difficult to refactor without extensive work, so suppress the potential NULL pointer error which cannot occur for now. Reviewed-by: Brian Behlendorf Signed-off-by: Giuseppe Di Natale Closes #5882 --- Makefile.am | 3 ++- module/zfs/zfs_vnops.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2cd2aabc5..3adc161ad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,7 +62,8 @@ lint: cppcheck paxcheck cppcheck: @if type cppcheck > /dev/null 2>&1; then \ - cppcheck --quiet --force --error-exitcode=2 ${top_srcdir}; \ + cppcheck --inline-suppr --quiet --force --error-exitcode=2 \ + ${top_srcdir}; \ fi paxcheck: diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 2e5099574..502e8f4a2 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -829,6 +829,7 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) aiov->iov_base != abuf->b_data)) { ASSERT(xuio); dmu_write(zsb->z_os, zp->z_id, woff, + // cppcheck-suppress nullPointer aiov->iov_len, aiov->iov_base, tx); dmu_return_arcbuf(abuf); xuio_stat_wbuf_copied(); -- 2.39.5