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-next>] [day] [month] [year] [list]
Message-ID: <aSsIP7oKrhKfCUv3@stanley.mountain>
Date: Sat, 29 Nov 2025 17:50:39 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Thomas Richard <thomas.richard@...tlin.com>
Cc: Peter Rosin <peda@...ntia.se>, Krzysztof Kozlowski <krzk@...nel.org>,
	Andrew Davis <afd@...com>, Thorsten Blum <thorsten.blum@...ux.dev>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH next] mux: mmio: Fix IS_ERR() vs NULL check in probe()

The devm_kmalloc() function never returns error pointers, it returns
NULL on error.  Fix the error checking.

Fixes: 4863cb2b0f50 ("mux: mmio: Add suspend and resume support")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
 drivers/mux/mmio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mux/mmio.c b/drivers/mux/mmio.c
index e4ddb1e61923..3409af1ffb80 100644
--- a/drivers/mux/mmio.c
+++ b/drivers/mux/mmio.c
@@ -101,13 +101,13 @@ static int mux_mmio_probe(struct platform_device *pdev)
 	mux_mmio = mux_chip_priv(mux_chip);
 
 	mux_mmio->fields = devm_kmalloc(dev, num_fields * sizeof(*mux_mmio->fields), GFP_KERNEL);
-	if (IS_ERR(mux_mmio->fields))
-		return PTR_ERR(mux_mmio->fields);
+	if (!mux_mmio->fields)
+		return -ENOMEM;
 
 	mux_mmio->hardware_states = devm_kmalloc(dev, num_fields *
 						 sizeof(*mux_mmio->hardware_states), GFP_KERNEL);
-	if (IS_ERR(mux_mmio->hardware_states))
-		return PTR_ERR(mux_mmio->hardware_states);
+	if (!mux_mmio->hardware_states)
+		return -ENOMEM;
 
 	for (i = 0; i < num_fields; i++) {
 		struct mux_control *mux = &mux_chip->mux[i];
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ