On Thu, Sep 04, 2025 at 01:10:57PM +1000, Wilfred Mallawa wrote:
> +/* From host to controller */
> +static uint16_t nvme_security_send(NvmeCtrl *n, NvmeRequest *req)
> +{
> +    uint32_t dw10 = le32_to_cpu(req->cmd.cdw10);
> +    uint8_t secp = (dw10 >> 24) & 0xff;
> +
> +    switch (secp) {
> +    case NVME_SEC_PROT_DMTF_SPDM:
> +        if (n->spdm_socket <= 0) {

0 is a valid file descriptor number. There are additional instances in
this patch series where 0 is treated as an error.

Please initialize the spdm_socket field to -1 and update the if
statements. Although you can probably get away with relying on never
getting fd 0 here in practice, making this assumption makes the code odd
because the reader doesn't know if this is a bug or intentional.

Stefan

Attachment: signature.asc
Description: PGP signature

Reply via email to