Skip to contentSkip to conversation

regulator: qcom-rpm: signedness bug in probe()

PATCH Applied Dan Carpenter 2 participants 2 messages Jan 28, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: qcom-rpm: signedness bug in probe()

"force_mode" is a u32 so it is never "< 0", but because of type promotion then comparing "= -1" will do what we want.

drivers/regulator/qcom_rpm-regulator.c +1 -1
index edd0a17..ec540aa 100644
@@ -769,7 +769,7 @@ static int rpm_reg_probe(struct platform_device *pdev)
 			break;
 		}
 
-		if (force_mode < 0) {
+		if (force_mode = -1) {
 			dev_err(&pdev->dev, "invalid force mode\n");
 			return -EINVAL;
 		}
maintainer Applied
#1 lore raw
Quoted 2 lines · Dan Carpenter

"force_mode" is a u32 so it is never "< 0", but because of type promotion then comparing "== -1" will do what we want.

Applied, thanks.