From: sashiko-bot@kernel.org
To: "Shuicheng Lin" <shuicheng.lin@intel.com>,
dri-devel@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/ttm: Don't warn on oversized page directory allocations
Date: Sat, 21 Nov 2026 09:32:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-226862@kernel.org> (raw)
In-Reply-To: <20261121091815.1436090-2-shuicheng.lin@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/ttm: missing __GFP_NOWARN in
ttm_sg_tt_alloc_page_directory()
--
commit b4df7a501d5e41a0a776550ea76ddd972d2c5a9c
Author: Shuicheng Lin <shuicheng.lin@intel.com>
drm/ttm: Don't warn on oversized page directory allocations
This commit passes __GFP_NOWARN to kvcalloc() in
ttm_tt_alloc_page_directory() and ttm_dma_tt_alloc_page_directory() to
prevent user-controlled BO sizes from triggering oversized allocation
warnings in kvmalloc().
> diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
> index b645a18181843..5dc9d3795b046 100644
> --- a/drivers/gpu/drm/ttm/ttm_tt.c
> +++ b/drivers/gpu/drm/ttm/ttm_tt.c
> @@ -117,7 +117,8 @@ EXPORT_SYMBOL_FOR_TESTS_ONLY(ttm_tt_create);
> */
> static int ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
> {
> - ttm->pages = kvcalloc(ttm->num_pages, sizeof(void*), GFP_KERNEL);
> + ttm->pages = kvcalloc(ttm->num_pages, sizeof(void *),
> + GFP_KERNEL | __GFP_NOWARN);
> if (!ttm->pages)
> return -ENOMEM;
>
> @@ -127,7 +128,8 @@ static int ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
> static int ttm_dma_tt_alloc_page_directory(struct ttm_tt *ttm)
> {
> ttm->pages = kvcalloc(ttm->num_pages, sizeof(*ttm->pages) +
> - sizeof(*ttm->dma_address), GFP_KERNEL);
> + sizeof(*ttm->dma_address),
> + GFP_KERNEL | __GFP_NOWARN);
> if (!ttm->pages)
> return -ENOMEM;
>
[Severity: Medium]
Should ttm_sg_tt_alloc_page_directory() immediately below also pass
GFP_KERNEL | __GFP_NOWARN to kvzalloc_objs()?
drivers/gpu/drm/ttm/ttm_tt.c:ttm_sg_tt_alloc_page_directory() {
ttm->dma_address = kvzalloc_objs(*ttm->dma_address, ttm->num_pages);
if (!ttm->dma_address)
return -ENOMEM;
return 0;
}
ttm_sg_tt_init() calls ttm_sg_tt_alloc_page_directory() for
TTM_TT_FLAG_EXTERNAL objects (such as ttm_bo_type_sg), which can be
reached when importing a dma-buf > 1 TiB via DRM_IOCTL_PRIME_FD_TO_HANDLE
(for example through amdgpu_gem_prime_import() ->
amdgpu_dma_buf_create_obj() -> amdgpu_gem_object_create(), which creates
and validates the BO in AMDGPU_GEM_DOMAIN_CPU before attaching the
dma-buf), triggering the same WARN_ON_ONCE(size > INT_MAX) in
__kvmalloc_node_noprof().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121091815.1436090-2-shuicheng.lin@intel.com?part=1
next prev parent reply other threads:[~2026-11-21 9:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 9:18 [PATCH] drm/ttm: Don't warn on oversized page directory allocations Shuicheng Lin
2026-11-21 9:27 ` ✓ CI.KUnit: success for " Patchwork
2026-11-21 9:32 ` sashiko-bot [this message]
2026-11-21 10:01 ` ✓ Xe.CI.BAT: " 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=sashiko-outbox-226862@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shuicheng.lin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox