57 lines
2.0 KiB
Diff
57 lines
2.0 KiB
Diff
|
From c820b898998aca63d597567724011182c4fa50cd Mon Sep 17 00:00:00 2001
|
||
|
Message-ID: <c820b898998aca63d597567724011182c4fa50cd.1707394627.git.jdenemar@redhat.com>
|
||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||
|
Date: Wed, 24 Jan 2024 15:13:16 +0100
|
||
|
Subject: [PATCH] virPCIVPDResourceGetKeywordPrefix: Fix logging
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Use VIR_DEBUG instead of VIR_INFO as that's more appropriate and report
|
||
|
relevant information for debugging.
|
||
|
|
||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
(cherry picked from commit ab3f4d1b0b9f29c924e928f8c6663b4076e49b38)
|
||
|
|
||
|
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
|
||
|
---
|
||
|
src/util/virpcivpd.c | 16 ++++++++--------
|
||
|
1 file changed, 8 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/src/util/virpcivpd.c b/src/util/virpcivpd.c
|
||
|
index b303e161ae..67065dec46 100644
|
||
|
--- a/src/util/virpcivpd.c
|
||
|
+++ b/src/util/virpcivpd.c
|
||
|
@@ -61,20 +61,20 @@ virPCIVPDResourceGetKeywordPrefix(const char *keyword)
|
||
|
g_autofree char *key = NULL;
|
||
|
|
||
|
/* Keywords must have a length of 2 bytes. */
|
||
|
- if (strlen(keyword) != 2) {
|
||
|
- VIR_INFO("The keyword length is not 2 bytes: %s", keyword);
|
||
|
- return NULL;
|
||
|
- } else if (!(virPCIVPDResourceIsUpperOrNumber(keyword[0]) &&
|
||
|
- virPCIVPDResourceIsUpperOrNumber(keyword[1]))) {
|
||
|
- VIR_INFO("The keyword is not comprised only of uppercase ASCII letters or digits");
|
||
|
- return NULL;
|
||
|
- }
|
||
|
+ if (strlen(keyword) != 2 ||
|
||
|
+ !(virPCIVPDResourceIsUpperOrNumber(keyword[0]) &&
|
||
|
+ virPCIVPDResourceIsUpperOrNumber(keyword[1])))
|
||
|
+ goto cleanup;
|
||
|
+
|
||
|
/* Special-case the system-specific keywords since they share the "Y" prefix with "YA". */
|
||
|
if (virPCIVPDResourceIsSystemKeyword(keyword) || virPCIVPDResourceIsVendorKeyword(keyword))
|
||
|
key = g_strndup(keyword, 1);
|
||
|
else
|
||
|
key = g_strndup(keyword, 2);
|
||
|
|
||
|
+ cleanup:
|
||
|
+ VIR_DEBUG("keyword='%s' key='%s'", keyword, NULLSTR(key));
|
||
|
+
|
||
|
return g_steal_pointer(&key);
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.43.0
|