From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe: remove header variable from parse_g2h_msg
Date: Mon, 31 Jul 2023 14:08:06 -0400 [thread overview]
Message-ID: <ZMf4hvT3K8GJmNbf@intel.com> (raw)
In-Reply-To: <20230729040211.36143-1-matthew.brost@intel.com>
On Fri, Jul 28, 2023 at 09:02:11PM -0700, Matthew Brost wrote:
> The header variable is unused, remove it.
>
> Suggested-by: Oded Gabbay <ogabbay@kernel.org>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_ct.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index d322eadbe75a..6c757efa88b8 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -829,12 +829,11 @@ static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
> static int parse_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
> {
> struct xe_device *xe = ct_to_xe(ct);
> - u32 header, hxg, origin, type;
> + u32 hxg, origin, type;
> int ret;
>
> lockdep_assert_held(&ct->lock);
>
> - header = msg[0];
Shouldn't we be parsing the header and checking for the len?
against corrupted messages?
something like on i915's intel_guc_ct.c:
/* message len with header */
len = FIELD_GET(GUC_CTB_MSG_0_NUM_DWORDS, header) + GUC_CTB_MSG_MIN_LEN;
if (unlikely(len > (u32)available)) {
CT_ERROR(ct, "Incomplete message %*ph %*ph %*ph\n",
4, &header,
4 * (head + available - 1 > size ?
size - head : available - 1), &cmds[head],
4 * (head + available - 1 > size ?
available - 1 - size + head : 0), &cmds[0]);
desc->status |= GUC_CTB_STATUS_UNDERFLOW;
goto corrupted;
}
> hxg = msg[1];
>
> origin = FIELD_GET(GUC_HXG_MSG_0_ORIGIN, hxg);
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-07-31 18:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-29 4:02 [Intel-xe] [PATCH] drm/xe: remove header variable from parse_g2h_msg Matthew Brost
2023-07-29 4:50 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-07-29 4:50 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-07-29 4:51 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-07-29 4:55 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-29 4:55 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-29 4:56 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-07-29 5:30 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-07-31 18:08 ` Rodrigo Vivi [this message]
2023-08-01 3:37 ` [Intel-xe] [PATCH] " Matthew Brost
2023-08-01 10:38 ` Rodrigo Vivi
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=ZMf4hvT3K8GJmNbf@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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.