From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5924598744087475070==" MIME-Version: 1.0 From: kbuild test robot 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 Message-ID: <202003221130.TCylRmXM%lkp@intel.com> List-Id: --===============5924598744087475070== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.gi= t repair-reap-fixes head: e55e1901603b56e1850c089a71c5b93c97c2d32f commit: 62b4fb2c08747bb7fd6d1ccecbfddc5ccc19e450 [17/26] xfs: introduce fak= e roots for ag-rooted btrees If you fix the issue, kindly add following tag Reported-by: kbuild test robot 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 previ= ously 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 st= aging 5023 * functionality work. If new_ops is not NULL, these new ops will b= e 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 =3D=3D NULL); 5037 = 5038 nops =3D kmem_alloc(sizeof(struct xfs_btree_ops), KM_NOFS); 5039 memcpy(nops, cur->bc_ops, sizeof(struct xfs_btree_ops)); > 5040 nops->alloc_block =3D xfs_btree_fakeroot_alloc_block; 5041 nops->free_block =3D xfs_btree_fakeroot_free_block; 5042 nops->init_ptr_from_cur =3D xfs_btree_fakeroot_init_ptr_from_cur; 5043 nops->set_root =3D xfs_btree_afakeroot_set_root; 5044 nops->dup_cursor =3D xfs_btree_fakeroot_dup_cursor; 5045 = 5046 cur->bc_private.a.afake =3D afake; 5047 cur->bc_nlevels =3D afake->af_levels; 5048 cur->bc_ops =3D nops; 5049 cur->bc_flags |=3D XFS_BTREE_STAGING; 5050 = 5051 if (new_ops) 5052 *new_ops =3D nops; 5053 } 5054 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============5924598744087475070==--