From: Ma Jun <Jun.Ma2@amd.com>
To: <amd-gfx@lists.freedesktop.org>, <christian.koenig@amd.com>,
<Alexander.Deucher@amd.com>
Cc: Ma Jun <Jun.Ma2@amd.com>
Subject: [PATCH] drm/amdgpu: Change the parameter of amdgpu_discovery_verify_binary_signature
Date: Tue, 26 Mar 2024 17:12:37 +0800 [thread overview]
Message-ID: <20240326091237.2863782-1-Jun.Ma2@amd.com> (raw)
Use struct binary_header directly as parameter of
amdgpu_discovery_verify_binary_signature()
Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 230412fc4d62..e6041f0b72fa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -334,11 +334,8 @@ static inline bool amdgpu_discovery_verify_checksum(uint8_t *data, uint32_t size
return !!(amdgpu_discovery_calculate_checksum(data, size) == expected);
}
-static inline bool amdgpu_discovery_verify_binary_signature(uint8_t *binary)
+static inline bool amdgpu_discovery_verify_binary_signature(struct binary_header *bhdr)
{
- struct binary_header *bhdr;
- bhdr = (struct binary_header *)binary;
-
return (le32_to_cpu(bhdr->binary_signature) == BINARY_SIGNATURE);
}
@@ -399,16 +396,16 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
goto out;
}
+ bhdr = (struct binary_header *)adev->mman.discovery_bin;
+
/* check the ip discovery binary signature */
- if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin)) {
+ if (!amdgpu_discovery_verify_binary_signature(bhdr)) {
dev_err(adev->dev,
"get invalid ip discovery binary signature\n");
r = -EINVAL;
goto out;
}
- bhdr = (struct binary_header *)adev->mman.discovery_bin;
-
offset = offsetof(struct binary_header, binary_checksum) +
sizeof(bhdr->binary_checksum);
size = le16_to_cpu(bhdr->binary_size) - offset;
--
2.34.1
reply other threads:[~2024-03-26 9:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240326091237.2863782-1-Jun.Ma2@amd.com \
--to=jun.ma2@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.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.