All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tejas Upadhyay" <tejas.upadhyay@intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH V4 2/2] gpu/tests/gpu_buddy: Add KUnit test for gpu_buddy_allocated_addr_to_block
Date: Thu, 06 Aug 2026 05:46:41 +0000	[thread overview]
Message-ID: <20260806054642.0E20F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260806053624.3215216-6-tejas.upadhyay@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Memory leak on KUnit assertion failure due to bypassed cleanup.
--

--- Patch [2]: [PATCH V4 2/2] gpu/tests/gpu_buddy: Add KUnit test for gpu_buddy_allocated_addr_to_block ---
commit 429e209c9177a128187845522d6b4613f6fbe30b
Author: Tejas Upadhyay <tejas.upadhyay@intel.com>

gpu/tests/gpu_buddy: Add KUnit test for gpu_buddy_allocated_addr_to_block

This patch adds a new KUnit test gpu_test_buddy_addr_to_block() to validate
the gpu_buddy_allocated_addr_to_block() helper function. The test verifies
exact address matching, unallocated addresses within the manager, and addresses
outside the manager bounds.

> diff --git a/drivers/gpu/tests/gpu_buddy_test.c b/drivers/gpu/tests/gpu_buddy_test.c
> index 89698563c61b2..5860bfc84a25a 100644
> --- a/drivers/gpu/tests/gpu_buddy_test.c
> +++ b/drivers/gpu/tests/gpu_buddy_test.c
> @@ -1422,6 +1422,50 @@ static void gpu_test_buddy_alloc_exceeds_max_order(struct kunit *test)
>  	gpu_buddy_fini(&mm);
>  }
>  
> +static void gpu_test_buddy_addr_to_block(struct kunit *test)
> +{
> +	struct gpu_buddy_block *allocated_block, *found_block;
> +	LIST_HEAD(allocated_list);
> +	const u64 test_size = SZ_4M + SZ_2M;
> +	const u64 alloc_start = SZ_4M;
> +	const u64 alloc_size = SZ_4K;
> +	const u64 chunk_size = SZ_4K;
> +	struct gpu_buddy mm;
> +
> +	KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_init(&mm, test_size, chunk_size),
> +			       "buddy_init failed\n");
> +
> +	KUNIT_ASSERT_FALSE_MSG(test, gpu_buddy_alloc_blocks(&mm, alloc_start,
> +							    alloc_start + alloc_size,
> +							    alloc_size, chunk_size,
> +							    &allocated_list, 0),
> +			       "buddy_alloc failed\n");

[Severity: Medium]
Will this leak memory if the allocation fails? KUNIT_ASSERT_FALSE_MSG() aborts
the test execution immediately on failure, bypassing the gpu_buddy_fini(&mm)
cleanup call at the end of the function. This would leak the memory allocated
by gpu_buddy_init().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260806053624.3215216-4-tejas.upadhyay@intel.com?part=2

  reply	other threads:[~2026-08-06  5:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  5:36 [PATCH V4 0/2] Add gpu_buddy_allocated_addr_to_block helper and its Kunit tests Tejas Upadhyay
2026-08-06  5:36 ` [PATCH V4 1/2] drm/gpu: Add gpu_buddy_allocated_addr_to_block helper Tejas Upadhyay
2026-08-06  5:36 ` [PATCH V4 2/2] gpu/tests/gpu_buddy: Add KUnit test for gpu_buddy_allocated_addr_to_block Tejas Upadhyay
2026-08-06  5:46   ` sashiko-bot [this message]
2026-08-06  9:00   ` Matthew Auld
2026-08-06  9:46     ` Upadhyay, Tejas
2026-08-06 10:19       ` Matthew Auld
2026-08-06 11:12         ` Arunpravin Paneer Selvam
2026-08-06 11:18           ` Upadhyay, Tejas
2026-08-06 11:32             ` Arunpravin Paneer Selvam
2026-08-06  5:43 ` ✓ CI.KUnit: success for Add gpu_buddy_allocated_addr_to_block helper and its Kunit tests (rev4) Patchwork
2026-08-06  6:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-06 15:15 ` ✗ Xe.CI.FULL: failure " Patchwork

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=20260806054642.0E20F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tejas.upadhyay@intel.com \
    /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.