lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <171863227141.10875.12415644003575440270.tip-bot2@tip-bot2>
Date: Mon, 17 Jun 2024 13:51:11 -0000
From: "tip-bot2 for Herve Codina" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Herve Codina <herve.codina@...tlin.com>,
 Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
 linux-kernel@...r.kernel.org, maz@...nel.org
Subject:
 [tip: irq/core] irqdomain: Make __irq_domain_create() return an error code

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     80f6abe0d39bc6ccf353290067ff589653ff922c
Gitweb:        https://git.kernel.org/tip/80f6abe0d39bc6ccf353290067ff589653ff922c
Author:        Herve Codina <herve.codina@...tlin.com>
AuthorDate:    Fri, 14 Jun 2024 19:32:11 +02:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 17 Jun 2024 15:48:13 +02:00

irqdomain: Make __irq_domain_create() return an error code

__irq_domain_create() can fail for several reasons. When it fails it
returns a NULL pointer and so filters out the exact failure reason.
The only user of __irq_domain_create() is irq_domain_instantiate() which
can return a PTR_ERR value. On __irq_domain_create() failure, it uses an
arbitrary error code.

Rather than using this arbitrary error value, make __irq_domain_create()
return is own error code and use that one.

[ tglx: Remove the pointless ERR_CAST. domain is a valid return pointer ]

Signed-off-by: Herve Codina <herve.codina@...tlin.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/r/20240614173232.1184015-11-herve.codina@bootlin.com

---
 kernel/irq/irqdomain.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 8dc0007..fe7bba6 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -187,17 +187,17 @@ static struct irq_domain *__irq_domain_create(const struct irq_domain_info *info
 	if (WARN_ON((info->size && info->direct_max) ||
 		    (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && info->direct_max) ||
 		    (info->direct_max && info->direct_max != info->hwirq_max)))
-		return NULL;
+		return ERR_PTR(-EINVAL);
 
 	domain = kzalloc_node(struct_size(domain, revmap, info->size),
 			      GFP_KERNEL, of_node_to_nid(to_of_node(info->fwnode)));
 	if (!domain)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	err = irq_domain_set_name(domain, info->fwnode);
 	if (err) {
 		kfree(domain);
-		return NULL;
+		return ERR_PTR(err);
 	}
 
 	domain->fwnode = fwnode_handle_get(info->fwnode);
@@ -260,8 +260,8 @@ struct irq_domain *irq_domain_instantiate(const struct irq_domain_info *info)
 	struct irq_domain *domain;
 
 	domain = __irq_domain_create(info);
-	if (!domain)
-		return ERR_PTR(-ENOMEM);
+	if (IS_ERR(domain))
+		return domain;
 
 	domain->flags |= info->domain_flags;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ