From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 727A435975 for ; Fri, 2 Jan 2026 04:10:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767327058; cv=none; b=qbc3/LtGXqDHm0m1gOi2yFF8Na3oZovrsgovnB0bxcJrtkqlXuHkMpN6sI8dFzaYWGYnmq9j74RtUen0/3LEUnhVWrmQzFlVchUEAnDqjU4fvHcsRitMjuig0KzKUC+aqQQHM7SCrQ0Se87GHaB63XEbO71OSXR4t7vekt08RcA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767327058; c=relaxed/simple; bh=pfP8FHtE4foQBk4IgW7Kzu3q+wphHGv6dFUHC8SmQAM=; h=Date:From:To:Cc:Subject:Message-ID; b=q5nsbFOLwWD/lzZLo12fvVDlqMN+nINPZOZ+hPr+4Q49vQILndR8t/6EmjGAZhzkVCnHT58GJIKAPJxVwHeDh5II9BYRloBRQVUtG9GLlaLYaSu7f9NkYK2Aes2nY/Yvc9o48Q9+8mwoGTLlzwCcM8M4aDQr8xig7Lh96rdJfYQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OjDa64IO; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OjDa64IO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767327055; x=1798863055; h=date:from:to:cc:subject:message-id; bh=pfP8FHtE4foQBk4IgW7Kzu3q+wphHGv6dFUHC8SmQAM=; b=OjDa64IOdS3FOSrBuvKQPtMd5AtmSqsryCrvAQKW/5AofSQZI94W/MpG eLUQcAiHIJEMjUtyV4Xv5N00+RxG7wXK84+n4gJaBdk5iNZCSRXi3MpVm brDfdFV2WPRBFczztKAVFoCva7CWeg1uqdZtp6f+TXN7FVCuhTI73Bdfk gF5pmtOh79F/5TePljO0E6zGosEv1UU3OLUPc9JgwqQyoUVt4IXRbZ3r8 Mtb9iDB0MBtkUi6VkubrwjFPserJYRZgBZfYnZIfBuT1aMB3JwfQU10dL fZdRzWKiaFwYfbFbRjyvNvaA+BU2AIktKtafokPFS5qmrHc1QlKnga4b0 Q==; X-CSE-ConnectionGUID: uexKsjVlTE2AAJl2jM/TDg== X-CSE-MsgGUID: JXSwu/YMS+KBnxybcxg+6g== X-IronPort-AV: E=McAfee;i="6800,10657,11658"; a="68870426" X-IronPort-AV: E=Sophos;i="6.21,196,1763452800"; d="scan'208";a="68870426" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jan 2026 20:10:54 -0800 X-CSE-ConnectionGUID: s7E/gdmLRZC0uSuUE8ajQw== X-CSE-MsgGUID: o6obzVjbQ4mlebwLr46xNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,196,1763452800"; d="scan'208";a="201372795" Received: from lkp-server01.sh.intel.com (HELO c9aa31daaa89) ([10.239.97.150]) by fmviesa007.fm.intel.com with ESMTP; 01 Jan 2026 20:10:53 -0800 Received: from kbuild by c9aa31daaa89 with local (Exim 4.98.2) (envelope-from ) id 1vbWV1-0000000027H-0TVr; Fri, 02 Jan 2026 04:10:51 +0000 Date: Fri, 02 Jan 2026 12:10:26 +0800 From: kernel test robot To: Filipe Manana Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, David Sterba , Boris Burkov Subject: fs/btrfs/ordered-data.c:215:5-11: ERROR: allocation function on line 173 returns NULL not ERR_PTR on failure Message-ID: <202601021217.PPsDsiqO-lkp@intel.com> User-Agent: s-nail v14.9.25 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: b69053dd3ffbc0d2dedbbc86182cdef6f641fe1b commit: 08c649a5637371cb6bf8f3e974323cf59a7f434b btrfs: check we grabbed inode reference when allocating an ordered extent date: 8 months ago config: arm-randconfig-r051-20251231 (https://download.01.org/0day-ci/archive/20260102/202601021217.PPsDsiqO-lkp@intel.com/config) compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 86b9f90b9574b3a7d15d28a91f6316459dcfa046) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202601021217.PPsDsiqO-lkp@intel.com/ cocci warnings: (new ones prefixed by >>) >> fs/btrfs/ordered-data.c:215:5-11: ERROR: allocation function on line 173 returns NULL not ERR_PTR on failure vim +215 fs/btrfs/ordered-data.c 147 148 static struct btrfs_ordered_extent *alloc_ordered_extent( 149 struct btrfs_inode *inode, u64 file_offset, u64 num_bytes, 150 u64 ram_bytes, u64 disk_bytenr, u64 disk_num_bytes, 151 u64 offset, unsigned long flags, int compress_type) 152 { 153 struct btrfs_ordered_extent *entry; 154 int ret; 155 u64 qgroup_rsv = 0; 156 const bool is_nocow = (flags & 157 ((1U << BTRFS_ORDERED_NOCOW) | (1U << BTRFS_ORDERED_PREALLOC))); 158 159 if (is_nocow) { 160 /* For nocow write, we can release the qgroup rsv right now */ 161 ret = btrfs_qgroup_free_data(inode, NULL, file_offset, num_bytes, &qgroup_rsv); 162 if (ret < 0) 163 return ERR_PTR(ret); 164 } else { 165 /* 166 * The ordered extent has reserved qgroup space, release now 167 * and pass the reserved number for qgroup_record to free. 168 */ 169 ret = btrfs_qgroup_release_data(inode, file_offset, num_bytes, &qgroup_rsv); 170 if (ret < 0) 171 return ERR_PTR(ret); 172 } > 173 entry = kmem_cache_zalloc(btrfs_ordered_extent_cache, GFP_NOFS); 174 if (!entry) { 175 entry = ERR_PTR(-ENOMEM); 176 goto out; 177 } 178 179 entry->file_offset = file_offset; 180 entry->num_bytes = num_bytes; 181 entry->ram_bytes = ram_bytes; 182 entry->disk_bytenr = disk_bytenr; 183 entry->disk_num_bytes = disk_num_bytes; 184 entry->offset = offset; 185 entry->bytes_left = num_bytes; 186 if (WARN_ON_ONCE(!igrab(&inode->vfs_inode))) { 187 kmem_cache_free(btrfs_ordered_extent_cache, entry); 188 entry = ERR_PTR(-ESTALE); 189 goto out; 190 } 191 entry->inode = inode; 192 entry->compress_type = compress_type; 193 entry->truncated_len = (u64)-1; 194 entry->qgroup_rsv = qgroup_rsv; 195 entry->flags = flags; 196 refcount_set(&entry->refs, 1); 197 init_waitqueue_head(&entry->wait); 198 INIT_LIST_HEAD(&entry->list); 199 INIT_LIST_HEAD(&entry->log_list); 200 INIT_LIST_HEAD(&entry->root_extent_list); 201 INIT_LIST_HEAD(&entry->work_list); 202 INIT_LIST_HEAD(&entry->bioc_list); 203 init_completion(&entry->completion); 204 205 /* 206 * We don't need the count_max_extents here, we can assume that all of 207 * that work has been done at higher layers, so this is truly the 208 * smallest the extent is going to get. 209 */ 210 spin_lock(&inode->lock); 211 btrfs_mod_outstanding_extents(inode, 1); 212 spin_unlock(&inode->lock); 213 214 out: > 215 if (IS_ERR(entry) && !is_nocow) 216 btrfs_qgroup_free_refroot(inode->root->fs_info, 217 btrfs_root_id(inode->root), 218 qgroup_rsv, BTRFS_QGROUP_RSV_DATA); 219 220 return entry; 221 } 222 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki