summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Courtney <ecourtney@nvidia.com>2026-03-06 10:22:03 +0300
committerAlexandre Courbot <acourbot@nvidia.com>2026-03-10 10:07:33 +0300
commitdcf1fdafe04095947f08db5a45d1994aa1d948fa (patch)
treebe9b45629c2a80e47fe7ca4f64d0516fd63929b2
parent1a0d4bc62b5d36a8ae4dca4413c2703b5fdd93f4 (diff)
downloadlinux-dcf1fdafe04095947f08db5a45d1994aa1d948fa.tar.xz
gpu: nova-core: gsp: unconditionally call variable payload handling
Unconditionally call the variable length payload code, which is a no-op if there is no such payload but could defensively catch some coding errors by e.g. checking that the allocated size is completely filled. Tested-by: Zhi Wang <zhiw@nvidia.com> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260306-cmdq-continuation-v6-6-cc7b629200ee@nvidia.com Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
-rw-r--r--drivers/gpu/nova-core/gsp/cmdq.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/gpu/nova-core/gsp/cmdq.rs b/drivers/gpu/nova-core/gsp/cmdq.rs
index 806b1e02715e..b41a866e24da 100644
--- a/drivers/gpu/nova-core/gsp/cmdq.rs
+++ b/drivers/gpu/nova-core/gsp/cmdq.rs
@@ -548,16 +548,14 @@ impl Cmdq {
command.init().__init(core::ptr::from_mut(cmd))?;
}
- // Fill the variable-length payload.
- if command_size > size_of::<M::Command>() {
- let mut sbuffer =
- SBufferIter::new_writer([&mut payload_1[..], &mut dst.contents.1[..]]);
- command.init_variable_payload(&mut sbuffer)?;
-
- if !sbuffer.is_empty() {
- return Err(EIO);
- }
+ // Fill the variable-length payload, which may be empty.
+ let mut sbuffer = SBufferIter::new_writer([&mut payload_1[..], &mut dst.contents.1[..]]);
+ command.init_variable_payload(&mut sbuffer)?;
+
+ if !sbuffer.is_empty() {
+ return Err(EIO);
}
+ drop(sbuffer);
// Compute checksum now that the whole message is ready.
dst.header