git: 6eabf4ce35ec - main - mac_veriexec ensure label fields are initialized

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Thu, 06 Jul 2023 16:26:56 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=6eabf4ce35ec1c79ab9a9dbe70ac934d62d2cd5d

commit 6eabf4ce35ec1c79ab9a9dbe70ac934d62d2cd5d
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2023-07-06 16:26:15 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-07-06 16:26:15 +0000

    mac_veriexec ensure label fields are initialized
    
    Obtained from: bkumara@juniper.net
---
 sys/security/mac_veriexec/veriexec_metadata.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/security/mac_veriexec/veriexec_metadata.c b/sys/security/mac_veriexec/veriexec_metadata.c
index 4e25b1672575..b0491bde7d16 100644
--- a/sys/security/mac_veriexec/veriexec_metadata.c
+++ b/sys/security/mac_veriexec/veriexec_metadata.c
@@ -732,14 +732,12 @@ search:
 	ip->ops = fpops;
 	ip->fileid = fileid;
 	ip->gen = gen;
+	ip->label = NULL;
+	ip->labellen = 0;
 	memcpy(ip->fingerprint, fingerprint, fpops->digest_len);
 	if (flags & VERIEXEC_LABEL)
 		ip->labellen = mac_veriexec_init_label(&ip->label,
 		    ip->labellen, label, labellen);
-	else {
-		ip->label = NULL;
-		ip->labellen = 0;
-	}
 
 	VERIEXEC_DEBUG(3, ("add file %ju.%lu (files=%d)\n",
 	    (uintmax_t)ip->fileid,