All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [djwong-xfs:repair-reap-fixes 17/26] fs/xfs/libxfs/xfs_btree.c:5040 xfs_btree_stage_afakeroot() error: potential null dereference 'nops'. (kmem_alloc returns null)
Date: Sun, 22 Mar 2020 11:12:33 +0800	[thread overview]
Message-ID: <202003221130.TCylRmXM%lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2232 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-reap-fixes
head:   e55e1901603b56e1850c089a71c5b93c97c2d32f
commit: 62b4fb2c08747bb7fd6d1ccecbfddc5ccc19e450 [17/26] xfs: introduce fake roots for ag-rooted btrees

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

New smatch warnings:
fs/xfs/libxfs/xfs_btree.c:5040 xfs_btree_stage_afakeroot() error: potential null dereference 'nops'.  (kmem_alloc returns null)

Old smatch warnings:
fs/xfs/libxfs/xfs_btree.c:1762 xfs_btree_lookup_get_block() error: we previously assumed 'bp' could be null (see line 1737)

vim +/nops +5040 fs/xfs/libxfs/xfs_btree.c

  5019	
  5020	/*
  5021	 * Initialize a AG-rooted btree cursor with the given AG btree fake root.  The
  5022	 * btree cursor's bc_ops will be overridden as needed to make the staging
  5023	 * functionality work.  If new_ops is not NULL, these new ops will be passed
  5024	 * out to the caller for further overriding.
  5025	 */
  5026	void
  5027	xfs_btree_stage_afakeroot(
  5028		struct xfs_btree_cur		*cur,
  5029		struct xbtree_afakeroot		*afake,
  5030		struct xfs_btree_ops		**new_ops)
  5031	{
  5032		struct xfs_btree_ops		*nops;
  5033	
  5034		ASSERT(!(cur->bc_flags & XFS_BTREE_STAGING));
  5035		ASSERT(!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE));
  5036		ASSERT(cur->bc_tp == NULL);
  5037	
  5038		nops = kmem_alloc(sizeof(struct xfs_btree_ops), KM_NOFS);
  5039		memcpy(nops, cur->bc_ops, sizeof(struct xfs_btree_ops));
> 5040		nops->alloc_block = xfs_btree_fakeroot_alloc_block;
  5041		nops->free_block = xfs_btree_fakeroot_free_block;
  5042		nops->init_ptr_from_cur = xfs_btree_fakeroot_init_ptr_from_cur;
  5043		nops->set_root = xfs_btree_afakeroot_set_root;
  5044		nops->dup_cursor = xfs_btree_fakeroot_dup_cursor;
  5045	
  5046		cur->bc_private.a.afake = afake;
  5047		cur->bc_nlevels = afake->af_levels;
  5048		cur->bc_ops = nops;
  5049		cur->bc_flags |= XFS_BTREE_STAGING;
  5050	
  5051		if (new_ops)
  5052			*new_ops = nops;
  5053	}
  5054	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

                 reply	other threads:[~2020-03-22  3:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202003221130.TCylRmXM%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.