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: <20260210-s2mpg1x-regulators-fixes-v2-1-ab3d3457f1ae@linaro.org>
Date: Tue, 10 Feb 2026 17:23:50 +0000
From: André Draszik <andre.draszik@...aro.org>
To: Krzysztof Kozlowski <krzk@...nel.org>, 
 Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org, 
 André Draszik <andre.draszik@...aro.org>, 
 Dan Carpenter <dan.carpenter@...aro.org>, 
 Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
Subject: [PATCH v2 1/2] regulator: s2mps11: drop redundant sanity checks in
 s2mpg10_of_parse_cb()

The sanity checks being removed in this commit are useless as earlier
code already checks for all conditions, including all error cases like
out-of-bounds conditions. In other words, the code being removed here
has no effect, as any potential error it could catch will already have
been caught by earlier code.

The checks removed here are also incomplete (as they're off-by-one) -
they should have been checking >= ARRAY_SIZE() to be complete.

Simply remove this redundant and incorrect code.

No functional change.

Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/all/aYmsu8qREppwBESH@stanley.mountain/
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@....qualcomm.com>
Signed-off-by: André Draszik <andre.draszik@...aro.org>
---
v2:
* reword commit message (Krzysztof)
---
 drivers/regulator/s2mps11.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 2d5510acd0780ab6f9296c48ddcde5efe15ff488..2d67c5c16f487506a2e9e4b119f33faa846269f7 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -478,8 +478,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
 			return -EINVAL;
 		}
 
-		if (ext_control > ARRAY_SIZE(ext_control_s2mpg10))
-			return -EINVAL;
 		ext_control = ext_control_s2mpg10[ext_control];
 		break;
 
@@ -503,8 +501,6 @@ static int s2mpg10_of_parse_cb(struct device_node *np,
 			return -EINVAL;
 		}
 
-		if (ext_control > ARRAY_SIZE(ext_control_s2mpg11))
-			return -EINVAL;
 		ext_control = ext_control_s2mpg11[ext_control];
 		break;
 

-- 
2.53.0.rc2.204.g2597b5adb4-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ