diff options
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/abd.c | 18 | ||||
-rw-r--r-- | module/zfs/zfs_vnops.c | 1 | ||||
-rw-r--r-- | module/zfs/zpl_xattr.c | 2 | ||||
-rw-r--r-- | module/zfs/zvol.c | 2 |
4 files changed, 12 insertions, 11 deletions
diff --git a/module/zfs/abd.c b/module/zfs/abd.c index 5e31d192e..0bd7a262f 100644 --- a/module/zfs/abd.c +++ b/module/zfs/abd.c @@ -250,7 +250,7 @@ abd_alloc_pages(abd_t *abd, size_t size) struct list_head pages; struct sg_table table; struct scatterlist *sg; - struct page *page, *tmp_page; + struct page *page, *tmp_page = NULL; gfp_t gfp = __GFP_NOWARN | GFP_NOIO; gfp_t gfp_comp = (gfp | __GFP_NORETRY | __GFP_COMP) & ~__GFP_RECLAIM; int max_order = MIN(zfs_abd_scatter_max_order, MAX_ORDER - 1); @@ -334,12 +334,12 @@ abd_alloc_pages(abd_t *abd, size_t size) static void abd_alloc_pages(abd_t *abd, size_t size) { - struct scatterlist *sg; + struct scatterlist *sg = NULL; struct sg_table table; struct page *page; gfp_t gfp = __GFP_NOWARN | GFP_NOIO; int nr_pages = abd_chunkcnt_for_bytes(size); - int i; + int i = 0; while (sg_alloc_table(&table, nr_pages, gfp)) { ABDSTAT_BUMP(abdstat_scatter_sg_table_retry); @@ -370,11 +370,11 @@ abd_alloc_pages(abd_t *abd, size_t size) static void abd_free_pages(abd_t *abd) { - struct scatterlist *sg; + struct scatterlist *sg = NULL; struct sg_table table; struct page *page; int nr_pages = ABD_SCATTER(abd).abd_nents; - int order, i; + int order, i = 0; if (abd->abd_flags & ABD_FLAG_MULTI_ZONE) ABDSTAT_BUMPDOWN(abdstat_scatter_page_multi_zone); @@ -543,8 +543,8 @@ abd_verify(abd_t *abd) ASSERT3P(abd->abd_u.abd_linear.abd_buf, !=, NULL); } else { size_t n; - int i; - struct scatterlist *sg; + int i = 0; + struct scatterlist *sg = NULL; ASSERT3U(ABD_SCATTER(abd).abd_nents, >, 0); ASSERT3U(ABD_SCATTER(abd).abd_offset, <, @@ -747,8 +747,8 @@ abd_get_offset_impl(abd_t *sabd, size_t off, size_t size) abd->abd_u.abd_linear.abd_buf = (char *)sabd->abd_u.abd_linear.abd_buf + off; } else { - int i; - struct scatterlist *sg; + int i = 0; + struct scatterlist *sg = NULL; size_t new_offset = sabd->abd_u.abd_scatter.abd_offset + off; abd = abd_alloc_struct(); diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index 703f6299f..a60cd6198 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -836,6 +836,7 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) aiov->iov_base != abuf->b_data)) { ASSERT(xuio); dmu_write(zfsvfs->z_os, zp->z_id, woff, + /* cppcheck-suppress nullPointer */ aiov->iov_len, aiov->iov_base, tx); dmu_return_arcbuf(abuf); xuio_stat_wbuf_copied(); diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c index 0c626b122..ebb6e7be2 100644 --- a/module/zfs/zpl_xattr.c +++ b/module/zfs/zpl_xattr.c @@ -333,7 +333,7 @@ zpl_xattr_get_sa(struct inode *ip, const char *name, void *value, size_t size) if (error) return (error); - if (!size) + if (size == 0 || value == NULL) return (nv_size); if (size < nv_size) diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index 2f75a2faa..5cd190c09 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -202,7 +202,7 @@ static zvol_state_t * zvol_find_by_name_hash(const char *name, uint64_t hash, int mode) { zvol_state_t *zv; - struct hlist_node *p; + struct hlist_node *p = NULL; mutex_enter(&zvol_state_lock); hlist_for_each(p, ZVOL_HT_HEAD(hash)) { |