Skip to content

FROMGIT: power: supply: qcom_battmgr: fix battery chemistry strncmp … - #1737

Merged
kotarake merged 1 commit into
qualcomm-linux:topics/tech/pmic/supplyfrom
tingguoc:topics/tech/pmic/supply
Aug 25, 2026
Merged

FROMGIT: power: supply: qcom_battmgr: fix battery chemistry strncmp …#1737
kotarake merged 1 commit into
qualcomm-linux:topics/tech/pmic/supplyfrom
tingguoc:topics/tech/pmic/supply

Conversation

@tingguoc

Copy link
Copy Markdown

FROMGIT: power: supply: qcom_battmgr: fix battery chemistry strncmp

The battery_chemistry field is a 4-byte array without guaranteed null termination. Using BATTMGR_CHEMISTRY_LEN (4) as the strncmp length for 3-character string literals implicitly requires chemistry[3] == '\0', which may not hold. Use 3 instead to match only the significant bytes.

Link: https://lore.kernel.org/all/20260812-fix-qcom-batt-chemistry-strn-v1-1-458545e02641@oss.qualcomm.com/

CRs-Fixed: 4562260

…ength

The battery_chemistry field is a 4-byte array without guaranteed null
termination. Using BATTMGR_CHEMISTRY_LEN (4) as the strncmp length for
3-character string literals implicitly requires chemistry[3] == '\0',
which may not hold. Use 3 instead to match only the significant bytes.

Link: https://lore.kernel.org/all/20260812-fix-qcom-batt-chemistry-strn-v1-1-458545e02641@oss.qualcomm.com/
Signed-off-by: Tingguo Cheng <tingguo.cheng@oss.qualcomm.com>
@tingguoc
tingguoc force-pushed the topics/tech/pmic/supply branch from bc9cd65 to 30addd7 Compare August 24, 2026 09:08
@kotarake
kotarake merged commit 398df55 into qualcomm-linux:topics/tech/pmic/supply Aug 25, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants