All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [linux-next:master 12839/13846] drivers/gpu/tests/gpu_buddy_test.c:1462 gpu_test_buddy_addr_to_block() warn: passing zero to 'PTR_ERR'
Date: Tue, 11 Aug 2026 04:45:43 +0800	[thread overview]
Message-ID: <202608110455.efwe8UOH-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Tejas Upadhyay <tejas.upadhyay@intel.com>
CC: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
CC: Matthew Auld <matthew.auld@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6b8c8af514d739d0335f5579b585e02babe8a727
commit: 3de014f7debc7162ae26db2f6151af1ba5456dc0 [12839/13846] gpu/tests/gpu_buddy: Add KUnit test for gpu_buddy_allocated_addr_to_block
:::::: branch date: 3 days ago
:::::: commit date: 4 days ago
config: m68k-randconfig-r071-20260810 (https://download.01.org/0day-ci/archive/20260811/202608110455.efwe8UOH-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 9.5.0
smatch: v0.5.0-9187-g5189e3fb

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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608110455.efwe8UOH-lkp@intel.com/

smatch warnings:
drivers/gpu/tests/gpu_buddy_test.c:1462 gpu_test_buddy_addr_to_block() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +1462 drivers/gpu/tests/gpu_buddy_test.c

dc0e3aa54eaa4f drivers/gpu/drm/tests/drm_buddy_test.c Sanjay Yadav   2026-01-08  1424  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1425  static void gpu_test_buddy_addr_to_block(struct kunit *test)
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1426  {
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1427  	struct gpu_buddy_block *allocated_block, *found_block;
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1428  	LIST_HEAD(allocated_list);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1429  	const u64 test_size = SZ_4M + SZ_2M;
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1430  	const u64 alloc_start = SZ_4M;
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1431  	const u64 alloc_size = SZ_4K;
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1432  	const u64 chunk_size = SZ_4K;
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1433  	struct gpu_buddy mm;
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1434  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1435  	KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_init(&mm, test_size, chunk_size),
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1436  			       "buddy_init failed\n");
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1437  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1438  	KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_alloc_blocks(&mm, alloc_start,
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1439  							    alloc_start + alloc_size,
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1440  							    alloc_size, chunk_size,
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1441  							    &allocated_list, 0),
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1442  			       "buddy_alloc failed\n");
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1443  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1444  	allocated_block = list_first_entry(&allocated_list, struct gpu_buddy_block, link);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1445  	KUNIT_EXPECT_EQ(test, gpu_buddy_block_offset(allocated_block), alloc_start);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1446  	KUNIT_EXPECT_EQ(test, gpu_buddy_block_size(&mm, allocated_block), alloc_size);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1447  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1448  	found_block = gpu_buddy_allocated_addr_to_block(&mm, alloc_start);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1449  	KUNIT_EXPECT_PTR_EQ(test, found_block, allocated_block);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1450  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1451  	/* Unaligned address inside the allocated block (should resolve to the same block) */
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1452  	found_block = gpu_buddy_allocated_addr_to_block(&mm, alloc_start + 16);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1453  	KUNIT_EXPECT_PTR_EQ(test, found_block, allocated_block);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1454  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1455  	/* An unallocated address inside the manager should return NULL. */
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1456  	found_block = gpu_buddy_allocated_addr_to_block(&mm,
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1457  							alloc_start - chunk_size);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1458  	KUNIT_EXPECT_NULL(test, found_block);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1459  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1460  	/* An address outside the manager should return -ENXIO. */
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1461  	found_block = gpu_buddy_allocated_addr_to_block(&mm, test_size);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06 @1462  	KUNIT_EXPECT_EQ(test, PTR_ERR(found_block), -ENXIO);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1463  
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1464  	/* 3. Standard inline cleanup flow */
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1465  	gpu_buddy_free_list(&mm, &allocated_list, 0);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1466  	gpu_buddy_fini(&mm);
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1467  }
3de014f7debc71 drivers/gpu/tests/gpu_buddy_test.c     Tejas Upadhyay 2026-08-06  1468  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-08-10 20:46 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=202608110455.efwe8UOH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.