From: Jani Nikula <jani.nikula@linux.intel.com>
To: Kees Cook <kees@kernel.org>
Cc: "Kees Cook" <kees@kernel.org>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Matt Roper" <matthew.d.roper@intel.com>,
"Gustavo Sousa" <gustavo.sousa@intel.com>,
"Andi Shyti" <andi.shyti@linux.intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
"Gnattu OC" <gnattuoc@me.com>,
"Nitin Gote" <nitin.r.gote@intel.com>,
"Ranu Maurya" <ranu.maurya@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Angus Chen" <angus.chen@intel.com>,
"Juha-Pekka Heikkila" <juhapekka.heikkila@gmail.com>,
"Yu Jiaoliang" <yujiaoliang@vivo.com>,
"Dnyaneshwar Bhadane" <dnyaneshwar.bhadane@intel.com>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] drm/i915/gt: Remove const from struct i915_wa list allocation
Date: Mon, 28 Apr 2025 14:40:16 +0300 [thread overview]
Message-ID: <874iy8y0nz.fsf@intel.com> (raw)
In-Reply-To: <20250426061357.work.749-kees@kernel.org>
On Fri, 25 Apr 2025, Kees Cook <kees@kernel.org> wrote:
> In preparation for making the kmalloc family of allocators type aware,
> we need to make sure that the returned type from the allocation matches
> the type of the variable being assigned. (Before, the allocator would
> always return "void *", which can be implicitly cast to any pointer type.)
>
> The assigned type is "struct i915_wa *". The returned type, while
> technically matching, will be const qualified. As there is no general
> way to remove const qualifiers, adjust the allocation type to match
> the assignment.
>
> Signed-off-by: Kees Cook <kees@kernel.org>
Acked-by: Jani Nikula <jani.nikula@intel.com>
for merging via whichever tree you find best; please let us know if you
want us to pick this up via drm-intel.
> ---
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Tvrtko Ursulin <tursulin@ursulin.net>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Simona Vetter <simona@ffwll.ch>
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Gustavo Sousa <gustavo.sousa@intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: <intel-gfx@lists.freedesktop.org>
> Cc: <dri-devel@lists.freedesktop.org>
> ---
> drivers/gpu/drm/i915/gt/intel_workarounds.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> index 116683ebe074..b37e400f74e5 100644
> --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c
> +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c
> @@ -156,7 +156,7 @@ static void _wa_add(struct i915_wa_list *wal, const struct i915_wa *wa)
> if (IS_ALIGNED(wal->count, grow)) { /* Either uninitialized or full. */
> struct i915_wa *list;
>
> - list = kmalloc_array(ALIGN(wal->count + 1, grow), sizeof(*wa),
> + list = kmalloc_array(ALIGN(wal->count + 1, grow), sizeof(*list),
> GFP_KERNEL);
> if (!list) {
> drm_err(&i915->drm, "No space for workaround init!\n");
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-04-28 11:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-26 6:13 [PATCH] drm/i915/gt: Remove const from struct i915_wa list allocation Kees Cook
2025-04-28 11:40 ` Jani Nikula [this message]
2025-04-30 20:56 ` Kees Cook
2025-05-07 13:05 ` Andi Shyti
2025-04-28 12:09 ` Tvrtko Ursulin
2025-04-30 20:56 ` Kees Cook
2025-05-07 15:50 ` Andi Shyti
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=874iy8y0nz.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=andi.shyti@linux.intel.com \
--cc=angus.chen@intel.com \
--cc=dnyaneshwar.bhadane@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gnattuoc@me.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=juhapekka.heikkila@gmail.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=nitin.r.gote@intel.com \
--cc=ranu.maurya@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
--cc=ville.syrjala@linux.intel.com \
--cc=yujiaoliang@vivo.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