Skip to content

Commit d998ddc

Browse files
Aleksandr Mishindlezcano
authored andcommitted
thermal/drivers/tsens: Fix null pointer dereference
compute_intercept_slope() is called from calibrate_8960() (in tsens-8960.c) as compute_intercept_slope(priv, p1, NULL, ONE_PT_CALIB) which lead to null pointer dereference (if DEBUG or DYNAMIC_DEBUG set). Fix this bug by adding null pointer check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: dfc1193 ("thermal/drivers/tsens: Replace custom 8960 apis with generic apis") Signed-off-by: Aleksandr Mishin <[email protected]> Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7954c92 commit d998ddc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/qcom/tsens.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void compute_intercept_slope(struct tsens_priv *priv, u32 *p1,
265265
for (i = 0; i < priv->num_sensors; i++) {
266266
dev_dbg(priv->dev,
267267
"%s: sensor%d - data_point1:%#x data_point2:%#x\n",
268-
__func__, i, p1[i], p2[i]);
268+
__func__, i, p1[i], p2 ? p2[i] : 0);
269269

270270
if (!priv->sensor[i].slope)
271271
priv->sensor[i].slope = SLOPE_DEFAULT;

0 commit comments

Comments
 (0)