This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 75fc19d729 virtio: Fix the problem of incorrect setting of virtio
queue address under tags kasan
75fc19d729 is described below
commit 75fc19d7297a451e9b4dfed07211e4d127197c71
Author: wangmingrong1 <[email protected]>
AuthorDate: Thu Dec 5 10:13:57 2024 +0800
virtio: Fix the problem of incorrect setting of virtio queue address under
tags kasan
There is also a printing error due to
https://github.com/apache/nuttx/pull/15043:
Configuration/Tool: rv-virt/virt_nsh
In file included from virtio/virtio-mmio.c:29:
virtio/virtio-mmio.c: In function 'virtio_mmio_init_device':
Error: virtio/virtio-mmio.c:826:14: error: format '%d' expects argument of
type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'}
[-Werror=format=]
826 | vrterr("Version %d not supported!\n", vdev->id.version);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
| |
| uint32_t {aka
long unsigned int}
virtio/virtio-mmio.c:826:24: note: format string is defined here
826 | vrterr("Version %d not supported!\n", vdev->id.version);
| ~^
| |
| int
| %ld
cc1: all warnings being treated as errors
make[1]: *** [Makefile:109: virtio-mmio.o] Error 1
make[1]: Target 'libdrivers.a' not remade because of errors.
Signed-off-by: wangmingrong1 <[email protected]>
---
drivers/virtio/virtio-mmio.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/virtio/virtio-mmio.c b/drivers/virtio/virtio-mmio.c
index 8788885e0d..049eff9816 100644
--- a/drivers/virtio/virtio-mmio.c
+++ b/drivers/virtio/virtio-mmio.c
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <nuttx/arch.h>
+#include <nuttx/mm/kasan.h>
#include <nuttx/virtio/virtio.h>
#include <nuttx/virtio/virtio-mmio.h>
@@ -342,15 +343,15 @@ static int virtio_mmio_config_virtqueue(FAR struct
metal_io_region *io,
{
metal_io_write32(io, VIRTIO_MMIO_QUEUE_NUM, vq->vq_nentries);
- addr = (uint64_t)(uintptr_t)vq->vq_ring.desc;
+ addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.desc);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_DESC_LOW, addr);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_DESC_HIGH, addr >> 32);
- addr = (uint64_t)(uintptr_t)vq->vq_ring.avail;
+ addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.avail);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_AVAIL_LOW, addr);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_AVAIL_HIGH, addr >> 32);
- addr = (uint64_t)(uintptr_t)vq->vq_ring.used;
+ addr = (uint64_t)kasan_reset_tag((FAR void *)vq->vq_ring.used);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_USED_LOW, addr);
metal_io_write32(io, VIRTIO_MMIO_QUEUE_USED_HIGH, addr >> 32);
@@ -823,7 +824,7 @@ static int virtio_mmio_init_device(FAR struct
virtio_mmio_device_s *vmdev,
vdev->id.version = metal_io_read32(&vmdev->cfg_io, VIRTIO_MMIO_VERSION);
if (vdev->id.version < 1 || vdev->id.version > 2)
{
- vrterr("Version %d not supported!\n", vdev->id.version);
+ vrterr("Version %"PRIu32" not supported!\n", vdev->id.version);
return -ENODEV;
}