[PATCH] net: pad virtio_net_ff_cap_data

"Michael S. Tsirkin" <[email protected]> Wed, 19 Nov 2025 03:23:35 -0500
Newsgroups dev.linux.lists.virtio-comment
Message-ID <0c8829841009a0094f24f87e013ff47e4d16721e.1763540610.git.mst@redhat.com>
struct virtio_net_ff_cap_data has 4 byte fields but the size is not a
multiple of 4.  drivers can easily get it wrong since compilers tend to
add padding to align such structures.

Since we are always allowed to pad or truncate admin commands, let's do
just that here.

Fixes: 899bb0c ("virtio-net: Add flow filter capability")
Cc: "Parav Pandit" <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
---
 device-types/net/description.tex | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/device-types/net/description.tex b/device-types/net/description.tex
index 9833d16..0b4fcac 100644
--- a/device-types/net/description.tex
+++ b/device-types/net/description.tex
@@ -3055,6 +3055,7 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope
         le32 rules_per_group_limit;
         u8 last_rule_priority;
         u8 selectors_per_classifier_limit;
+        u8 reserved[2];
 };
 \end{lstlisting}
 
@@ -3071,6 +3072,8 @@ \subsubsection{Flow filter}\label{sec:Device Types / Network Device / Device Ope
 \field{selectors_per_classifier_limit} is the maximum number of selectors
 that a classifier can have.
 
+\field{reserved} is reserved and set to zero.
+
 \subparagraph{VIRTIO_NET_FF_SELECTOR_CAP}
 \label{par:Device Types / Network Device / Device Operation / Flow filter / Device and driver capabilities / VIRTIO-NET-FF-SELECTOR-CAP}
 
-- 
MST