From: sashiko-bot@kernel.org
To: "Ketil Johnsen" <ketil.johnsen@arm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 09/12] drm/panthor: Create kernel BO from existing GEM
Date: Mon, 12 Oct 2026 13:12:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-168147@kernel.org> (raw)
In-Reply-To: <20261012125940.3291951-10-ketil.johnsen@arm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/panthor: integer truncation of size_t to u32 in panthor_kernel_bo_create_from_gem()
- [Low] drm/panthor: unused usage_flags parameter in panthor_gem_create()
--
commit e696a47bb56852d031f4d4fbdb9474523f19a3f1
Author: Boris Brezillon <boris.brezillon@collabora.com>
drm/panthor: Create kernel BO from existing GEM
Refactors/splits existing panthor_kernel_bo_create(). Adds
panthor_kernel_bo_create_from_gem() so we can create kernel BOs
from imported protected memory in future change.
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index 0af4ae47780be..ec6eba8e2ac3a 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
[ ... ]
> @@ -1036,7 +1036,6 @@ panthor_gem_create(struct drm_device *dev, size_t size, uint32_t flags,
> bo->base.resv = bo->exclusive_vm_root_gem->resv;
> }
>
> - panthor_gem_debugfs_add_usage_flags(bo, usage_flags);
> panthor_gem_debugfs_bo_add(bo);
> return bo;
[Severity: Low]
Since the call to panthor_gem_debugfs_add_usage_flags() is removed here, does
this leave the usage_flags parameter entirely unused in panthor_gem_create()?
Should the parameter be removed from the function signature as well to avoid
dead code?
[ ... ]
> @@ -1274,46 +1275,33 @@ void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo)
> }
>
> /**
> - * panthor_kernel_bo_create() - Create and map a GEM object to a VM
> + * panthor_kernel_bo_create_from_gem() - Create kernel BO from existing GEM object
[ ... ]
> struct panthor_kernel_bo *
> -panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> - size_t size, u32 bo_flags, u32 vm_map_flags,
> - u64 gpu_va, const char *name)
> +panthor_kernel_bo_create_from_gem(struct panthor_device *ptdev,
> + struct panthor_vm *vm,
> + struct panthor_gem_object *bo,
> + u32 vm_map_flags, u64 gpu_va, u32 vm_map_size)
[Severity: Medium]
Does this cause an implicit integer truncation on 64-bit platforms?
The panthor_kernel_bo_create() function takes size as a size_t (which is 64
bits wide), but passes it to vm_map_size here, which is declared as a u32:
panthor_kernel_bo_create(..., size_t size, ...)
{
...
kbo = panthor_kernel_bo_create_from_gem(ptdev, vm, bo, vm_map_flags,
gpu_va, size);
...
}
Could this lead to silent partial allocations or out-of-bounds accesses if a
kernel BO size ever exceeds 4GB?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261012125940.3291951-1-ketil.johnsen@arm.com?part=9
next prev parent reply other threads:[~2026-10-12 13:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 12:59 [PATCH v4 00/12] drm/panthor: Protected mode support for Mali CSF GPUs Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 01/12] drm/panthor: De-duplicate FW memory section sync Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 02/12] drm/panthor: Minor scheduler refactoring Ketil Johnsen
2026-10-12 13:05 ` sashiko-bot
2026-10-12 12:59 ` [PATCH v4 03/12] drm/panthor: Pass drm_file instead of panthor_file Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 04/12] drm/panthor: Don't allocate protm_suspend_buf Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 05/12] drm/panthor: Add support for entering and exiting protected mode Ketil Johnsen
2026-10-12 13:17 ` sashiko-bot
2026-10-12 12:59 ` [PATCH v4 06/12] drm/panthor: New function for FW section map flags Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 07/12] drm/panthor: Keep size and VA in FW section obj Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 08/12] drm/panthor: Refactor GEM usage flags assignment Ketil Johnsen
2026-10-12 12:59 ` [PATCH v4 09/12] drm/panthor: Create kernel BO from existing GEM Ketil Johnsen
2026-10-12 13:12 ` sashiko-bot [this message]
2026-10-12 12:59 ` [PATCH v4 10/12] drm/panthor: Support FW init of protm Ketil Johnsen
2026-10-12 13:15 ` sashiko-bot
2026-10-12 12:59 ` [PATCH v4 11/12] drm/panthor: Protm support for groups Ketil Johnsen
2026-10-12 13:15 ` sashiko-bot
2026-10-12 12:59 ` [PATCH v4 12/12] drm/panthor: Bump version to expose protm feature Ketil Johnsen
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-168147@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ketil.johnsen@arm.com \
--cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox