Skip to contentSkip to conversation

soc: qcom: smem: Fix signedness bug in smem_dram_parse()

PATCH Applied Dan Carpenter 3 participants 3 messages Aug 13 – Sep 1

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

PATCH 1/1 soc: qcom: smem: Fix signedness bug in smem_dram_parse()

The "ver" variable is type "enum ddr_info_version". Enum types are dependent on the compiler but in practical terms here, "ver" is basically an unsigned int. It needs to be signed for the -EINVAL to be handled correctly.

Fixes 1d234eeafc56 ("soc: qcom: smem: Expose DDR data from SMEM")
---
 drivers/soc/qcom/smem_dramc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/smem_dramc.c +1 -1
index 63ebe7f6db59..6283e9317f19 100644
@@ -382,7 +382,7 @@ struct dentry *smem_dram_parse(struct qcom_smem *smem, struct device *dev)
 		return ERR_PTR(-ENODATA);
 
 	ver = smem_dram_infer_struct_version(actual_size);
-	if (ver < 0) {
+	if ((int)ver < 0) {
 		/* Some SoCs don't provide data that's useful for us */
 		return ERR_PTR(-ENODATA);
 	} else if (ver == INFO_UNKNOWN) {
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dan Carpenter

The "ver" variable is type "enum ddr_info_version". Enum types are dependent on the compiler but in practical terms here, "ver" is basically an unsigned int. It needs to be signed for the -EINVAL to be handled correctly.

Fixes 1d234eeafc56 ("soc: qcom: smem: Expose DDR data from SMEM")

---

Konrad

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter

The "ver" variable is type "enum ddr_info_version". Enum types are dependent on the compiler but in practical terms here, "ver" is basically an unsigned int. It needs to be signed for the -EINVAL to be handled correctly.

Applied, thanks!

[1/1] soc: qcom: smem: Fix signedness bug in smem_dram_parse()

      commit: 22f129fedb153a17d80b1d883a7c4dd2417cf38e

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>