From: Tim Small <tim@seoss.co.uk>
Signed-off-by: Tim Small <tim@seoss.co.uk>
---
Changes since earlier patch versions:
Since V2:
. Fix missing from line in patch body
. Add this narrative
Since V1:
. Formatting - ref Peter Krempa's feedback
src/security/virt-aa-helper.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index e3802c18be..6481e9cfd7 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1134,10 +1134,10 @@ get_files(vahControl * ctl)
}
for (i = 0; i < ctl->def->nnets; i++) {
- if (ctl->def->nets[i] &&
- ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
- ctl->def->nets[i]->data.vhostuser) {
- virDomainChrSourceDef *vhu = ctl->def->nets[i]->data.vhostuser;
+ virDomainNetDef *net = ctl->def->nets[i];
+
+ if (net && net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER && net->data.vhostuser) {
+ virDomainChrSourceDef *vhu = net->data.vhostuser;
if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",
vhu->type) != 0)
--
2.47.2
On 6/9/25 13:59, Tim Small via Devel wrote:
> From: Tim Small <tim@seoss.co.uk>
>
> Signed-off-by: Tim Small <tim@seoss.co.uk>
> ---
>
> Changes since earlier patch versions:
>
> Since V2:
> . Fix missing from line in patch body
> . Add this narrative
>
> Since V1:
> . Formatting - ref Peter Krempa's feedback
>
> src/security/virt-aa-helper.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
> index e3802c18be..6481e9cfd7 100644
> --- a/src/security/virt-aa-helper.c
> +++ b/src/security/virt-aa-helper.c
> @@ -1134,10 +1134,10 @@ get_files(vahControl * ctl)
> }
>
> for (i = 0; i < ctl->def->nnets; i++) {
> - if (ctl->def->nets[i] &&
> - ctl->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
> - ctl->def->nets[i]->data.vhostuser) {
> - virDomainChrSourceDef *vhu = ctl->def->nets[i]->data.vhostuser;
> + virDomainNetDef *net = ctl->def->nets[i];
> +
> + if (net && net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER && net->data.vhostuser) {
Pre-existing, but I always wondered how can ctl->def->nets[i] be NULL
when we're iterating over nnets. It can't. I'll probably post a patch
that removes these non-NULL checks in the whole function.
> + virDomainChrSourceDef *vhu = net->data.vhostuser;
>
> if (vah_add_file_chardev(&buf, vhu->data.nix.path, "rw",
> vhu->type) != 0)
Michal
© 2016 - 2026 Red Hat, Inc.