[PATCH v2 3/5] virtio: mmio: Keep vendor id little endian

Daniel Palmer daniel at thingy.jp
Tue Apr 7 10:20:47 CEST 2026


Hi Kuan-Wei,

On Tue, 7 Apr 2026 at 01:54, Kuan-Wei Chiu <visitorckw at gmail.com> wrote:
> This direct memory cast relies on little endian byte ordering to spell
> "QEMU". On big endian machines, the memory layout naturally spells
> "UMEQ".
>
> So maybe we can extract the characters safely using bitwise shifts like
> this?

I think this has uncovered a more important bug..

 /*
  * virtio mmio transport supplies string identification for us,
  * while pci trnasport uses a 2-byte subvendor value.
   */
 if (uc_priv->vendor >> 16)
      sprintf(desc->vendor, "%s", (char *)&uc_priv->vendor);

The comment makes no sense. uc_priv->vendor is a u32. The id might be
ASCII chars but it's not a C-string. It's only working right now
because by luck after the chars in the u32 there is a 0.

Anyhow, I think I've fixed this properly so I will send that in v3.

Cheers,

Daniel


More information about the U-Boot mailing list