All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: fs/xfs/libxfs/xfs_btree_staging.c:144 xfs_btree_stage_afakeroot() error: potential null dereference 'nops'. (kmem_alloc returns null)
Date: Sat, 30 May 2020 05:00:07 +0800	[thread overview]
Message-ID: <202005300504.mXUcjSip%lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   75caf310d16cc5e2f851c048cd597f5437013368
commit: e06536a692e032470130af5b2136b519595809da xfs: introduce fake roots for ag-rooted btrees
date:   2 months ago
config: i386-randconfig-m021-20200529 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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

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

vim +/nops +144 fs/xfs/libxfs/xfs_btree_staging.c

   125	
   126	/*
   127	 * Initialize a AG-rooted btree cursor with the given AG btree fake root.
   128	 * The btree cursor's bc_ops will be overridden as needed to make the staging
   129	 * functionality work.
   130	 */
   131	void
   132	xfs_btree_stage_afakeroot(
   133		struct xfs_btree_cur		*cur,
   134		struct xbtree_afakeroot		*afake)
   135	{
   136		struct xfs_btree_ops		*nops;
   137	
   138		ASSERT(!(cur->bc_flags & XFS_BTREE_STAGING));
   139		ASSERT(!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE));
   140		ASSERT(cur->bc_tp == NULL);
   141	
   142		nops = kmem_alloc(sizeof(struct xfs_btree_ops), KM_NOFS);
   143		memcpy(nops, cur->bc_ops, sizeof(struct xfs_btree_ops));
 > 144		nops->alloc_block = xfs_btree_fakeroot_alloc_block;
   145		nops->free_block = xfs_btree_fakeroot_free_block;
   146		nops->init_ptr_from_cur = xfs_btree_fakeroot_init_ptr_from_cur;
   147		nops->set_root = xfs_btree_afakeroot_set_root;
   148		nops->dup_cursor = xfs_btree_fakeroot_dup_cursor;
   149	
   150		cur->bc_ag.afake = afake;
   151		cur->bc_nlevels = afake->af_levels;
   152		cur->bc_ops = nops;
   153		cur->bc_flags |= XFS_BTREE_STAGING;
   154	}
   155	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38946 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: "Darrick, J., Wong," <darrick.wong@oracle.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Brian Foster <bfoster@redhat.com>
Subject: fs/xfs/libxfs/xfs_btree_staging.c:144 xfs_btree_stage_afakeroot() error: potential null dereference 'nops'.  (kmem_alloc returns null)
Date: Sat, 30 May 2020 05:00:07 +0800	[thread overview]
Message-ID: <202005300504.mXUcjSip%lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   75caf310d16cc5e2f851c048cd597f5437013368
commit: e06536a692e032470130af5b2136b519595809da xfs: introduce fake roots for ag-rooted btrees
date:   2 months ago
config: i386-randconfig-m021-20200529 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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

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

vim +/nops +144 fs/xfs/libxfs/xfs_btree_staging.c

   125	
   126	/*
   127	 * Initialize a AG-rooted btree cursor with the given AG btree fake root.
   128	 * The btree cursor's bc_ops will be overridden as needed to make the staging
   129	 * functionality work.
   130	 */
   131	void
   132	xfs_btree_stage_afakeroot(
   133		struct xfs_btree_cur		*cur,
   134		struct xbtree_afakeroot		*afake)
   135	{
   136		struct xfs_btree_ops		*nops;
   137	
   138		ASSERT(!(cur->bc_flags & XFS_BTREE_STAGING));
   139		ASSERT(!(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE));
   140		ASSERT(cur->bc_tp == NULL);
   141	
   142		nops = kmem_alloc(sizeof(struct xfs_btree_ops), KM_NOFS);
   143		memcpy(nops, cur->bc_ops, sizeof(struct xfs_btree_ops));
 > 144		nops->alloc_block = xfs_btree_fakeroot_alloc_block;
   145		nops->free_block = xfs_btree_fakeroot_free_block;
   146		nops->init_ptr_from_cur = xfs_btree_fakeroot_init_ptr_from_cur;
   147		nops->set_root = xfs_btree_afakeroot_set_root;
   148		nops->dup_cursor = xfs_btree_fakeroot_dup_cursor;
   149	
   150		cur->bc_ag.afake = afake;
   151		cur->bc_nlevels = afake->af_levels;
   152		cur->bc_ops = nops;
   153		cur->bc_flags |= XFS_BTREE_STAGING;
   154	}
   155	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38946 bytes --]

             reply	other threads:[~2020-05-29 21:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 21:00 kbuild test robot [this message]
2020-05-29 21:00 ` fs/xfs/libxfs/xfs_btree_staging.c:144 xfs_btree_stage_afakeroot() error: potential null dereference 'nops'. (kmem_alloc returns null) kbuild test robot

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=202005300504.mXUcjSip%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.