| From | Wilfred Mallawa <> | | Subject | Re: [RFC v3 12/27] lib: rspdm: Support SPDM get_version | | Date | Wed, 11 Feb 2026 04:00:50 +0000 |
| |
This is cool! some minor comments inline.
> > /// The current SPDM session state for a device. Based on the > /// C `struct spdm_state`. > @@ -61,7 +64,7 @@ pub(crate) fn new( > transport_sz, > keyring, > validate, > - version: 0x10, > + version: SPDM_MIN_VER, > } > } > > @@ -217,4 +220,53 @@ pub(crate) fn spdm_exchange( > > Ok(length) > } > + > + /// Negoiate a supported SPDM version and store the information
typo: s/Negoiate/Negotiate
> + /// in the `SpdmState`. > + pub(crate) fn get_version(&mut self) -> Result<(), Error> { > + let mut request = GetVersionReq::default(); > + request.version = self.version; > + > + // SAFETY: `request` is repr(C) and packed, so we can > convert it to a slice > + let request_buf = unsafe { > + from_raw_parts_mut( > + &mut request as *mut _ as *mut u8, > + core::mem::size_of::<GetVersionReq>(), > + ) > + }; > + > + let mut response_vec: KVec<u8> = > KVec::with_capacity(SPDM_GET_VERSION_LEN, GFP_KERNEL)?; > + // SAFETY: `request` is repr(C) and packed, so we can > convert it to a slice
The SAFETY comment here refers to `request` when setting up the response buffer, seems unneeded?
Wilfred
|