On 15/11/13 10:40, Jonghwan Choi wrote:
> This patch looks like it should be in the 3.11-stable tree, should we apply
> it?
On its own, probably not. For it to be useful, you'd also need the other
patch series from Rusty reworking the virtio accessors, which is a bit
more invasive.
Rusty, what do you think?
M.
> ------------------
>
> From: "Marc Zyngier <[email protected]>"
>
> commit 4ae85370720156025e9cb873c13a0afb06ca1612 upstream
>
> As virtio-mmio config registers are specified to be little-endian,
> using readl() to read the magic value and then memcmp() to check it
> fails on BE (as readl() has an implicit swab).
>
> Fix it by encoding the magic value as an integer instead of a string.
>
> Cc: Michael S. Tsirkin <[email protected]>
> Signed-off-by: Marc Zyngier <[email protected]>
> Acked-by: Pawel Moll <[email protected]>
> Signed-off-by: Rusty Russell <[email protected]>
> Signed-off-by: Jonghwan Choi <[email protected]>
> ---
> drivers/virtio/virtio_mmio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 1ba0d68..57f24fd 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -470,7 +470,7 @@ static int virtio_mmio_probe(struct platform_device
> *pdev)
>
> /* Check magic value */
> magic = readl(vm_dev->base + VIRTIO_MMIO_MAGIC_VALUE);
> - if (memcmp(&magic, "virt", 4) != 0) {
> + if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {
> dev_warn(&pdev->dev, "Wrong magic value 0x%08lx!\n", magic);
> return -ENODEV;
> }
>
--
Jazz is not dead. It just smells funny...
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html