[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 2/3] xen: x86: irq: initialize irq desc in create_irq()
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Date: Thu, 27 Mar 2025 00:40:51 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SEZnUOLnZm9F/fmyW7D8ug/laXFR6uaOFnmYo9TVn0E=; b=GYkVVRwjOs2OJ0Wgo+sKM9kOEXCRQEnXMVGFVWPwTqqwSc0B9BYnLJk5gVw+mNZ3IpgymerqtcKdwpc3gZ+V32H9SMK1vXhsdEzMqpvl8WL1Ls2aX7Vf9Xc9i34HjjdxAA/jHMmYrpI/rh+RIAkmUbb3bL/2RwKyKrhSvxFrCjpXa7/CQUV0fHauxDWYzPeMNVLhcPHloz5jIPQUMrzz7lR9OU8xvlX7V91xJmdeOmGOAe2yf5qnUqZzN+KvjJe3Bf5yKWXt/Sc9snYc+2lS41WUMK1wg3OGit2S1Bcn8bTglpdbHOlZ1fffO5JFS85khA9Lny4xXwNtFYBWX4bBjQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AKzzv1OeRjXHVIHaozXP04ACeXZ8+QE8RNOTn3UtpuOCcPmCtFfrgYWSOEDt9xXjXGOuus3zYBYMr2dbx9SWO/FvWLt3o8Gq/zTGlg1Iw2Ci9gkfEwzZ5IHe2y1a06eX4U7xclJjkXWLLKm0lOlyi4NU0hd/jNHJ1Xt0ys5wuJxABrwTmzrWwkHqMXLDv2OX1PeRMwqSs848LlDvXhc5myZnvi35HmJ1I9zrD3bC3GbsHChZy0Y0QAvbgAUasoru/9U7mKe30hISI/UWQ7quQMy0b2p7MToMsVefLiHl3n6fkgwq5A3oVDEdRE1j/N+0E4UmVEf7hBXVJ2KEwiG2AQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Thu, 27 Mar 2025 00:41:14 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHbnrDjW+8Ym1NjVUmmlSXcOEREog==
- Thread-topic: [PATCH v1 2/3] xen: x86: irq: initialize irq desc in create_irq()
While building xen with GCC 14.2.1 with "-fcondition-coverage" option,
the compiler produces a false positive warning:
arch/x86/irq.c: In function ‘create_irq’:
arch/x86/irq.c:281:11: error: ‘desc’ may be used uninitialized
[-Werror=maybe-uninitialized]
281 | ret = init_one_irq_desc(desc);
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/x86/irq.c:269:22: note: ‘desc’ was declared here
269 | struct irq_desc *desc;
| ^~~~
cc1: all warnings being treated as errors
make[2]: *** [Rules.mk:252: arch/x86/irq.o] Error 1
While we have signed/unsigned comparison both in "for" loop and in
"if" statement, this still can't lead to use of uninitialized "desc",
as either loop will be executed at least once, or the function will
return early. So this is a clearly false positive warning. Anyways,
initialize "desc" with NULL to make GCC happy.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
Attempt to declare "irq" as "unsigned int" didn't changed anything, so
looks like compiler infers unitialized via some other reasoning... And
it is interesting that this issue can be observed only with MC/DC enabled.
---
xen/arch/x86/irq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index dd8d921f18..ae7224a145 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -265,7 +265,7 @@ void __init clear_irq_vector(int irq)
int create_irq(nodeid_t node, bool grant_access)
{
int irq, ret;
- struct irq_desc *desc;
+ struct irq_desc *desc = NULL;
for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
{
--
2.48.1
|