Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci virtio(4): Use flexible array members, not zero-...



details:   https://anonhg.NetBSD.org/src/rev/eefe2f85ba06
branches:  trunk
changeset: 374053:eefe2f85ba06
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Mar 29 09:45:05 2023 +0000

description:
virtio(4): Use flexible array members, not zero-length arrays.

This enables the compiler to detect sizeof mistakes like
PR kern/57304.

diffstat:

 sys/dev/pci/virtioreg.h |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b94a91533962 -r eefe2f85ba06 sys/dev/pci/virtioreg.h
--- a/sys/dev/pci/virtioreg.h   Wed Mar 29 09:44:25 2023 +0000
+++ b/sys/dev/pci/virtioreg.h   Wed Mar 29 09:45:05 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: virtioreg.h,v 1.11 2022/10/15 20:00:35 riastradh Exp $ */
+/*     $NetBSD: virtioreg.h,v 1.12 2023/03/29 09:45:05 riastradh Exp $ */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -153,7 +153,7 @@ struct vring_desc {
 struct vring_avail {
         uint16_t flags;
         uint16_t idx;
-        uint16_t ring[0];
+        uint16_t ring[];
        /* trailed by uint16_t used_event when VIRTIO_F_RING_EVENT_IDX */
 } __packed;
 
@@ -168,7 +168,7 @@ struct vring_used_elem {
 struct vring_used {
         uint16_t flags;
         uint16_t idx;
-        struct vring_used_elem ring[0];
+        struct vring_used_elem ring[];
        /* trailed by uint16_t avail_event when VIRTIO_F_RING_EVENT_IDX */
 } __packed;
 



Home | Main Index | Thread Index | Old Index