Open kristofpetho opened 3 years ago
I just check the codes there, it is actually "BATT_TEMP_INVALID" .
Can you please explain why you think that BATT_TEMP_INVALID
is valid there?
comm_dev->ffc_temp_dynamic_thr
is a structure of size FFC_TEMP_INVALID - 1
. Currently, BATT_TEMP_INVALID
is bigger than FFC_TEMP_INVALID
, so once the loop reaches the FFC_TEMP_INVALID
value (currently 4
, but the specifics don't really matter), it'll be overwriting later fields like possibly temp_region
, ffc_temp_region
and part of the comm_cfg
field/structure (I'd have to check alignment rules on aarch64 to find out specifics).
The initial reporter's request sounds sane, unless I missed something critical.
Can you please explain why you think that
BATT_TEMP_INVALID
is valid there?
comm_dev->ffc_temp_dynamic_thr
is a structure of sizeFFC_TEMP_INVALID - 1
. Currently,BATT_TEMP_INVALID
is bigger thanFFC_TEMP_INVALID
, so once the loop reaches theFFC_TEMP_INVALID
value (currently4
, but the specifics don't really matter), it'll be overwriting later fields like possiblytemp_region
,ffc_temp_region
and part of thecomm_cfg
field/structure (I'd have to check alignment rules on aarch64 to find out specifics).The initial reporter's request sounds sane, unless I missed something critical.
That was exactly my thinking. It was actually caught by GCC as an error...
https://github.com/OnePlusOSS/android_kernel_oneplus_sm8350/blob/2206c099f741005fb38dd941455f78eecf4a6104/techpack/oneplus/power/oplus_chg/oplus_chg_comm.c#L1436
Hi @YuHuang65, should this not be "FFC_TEMP_INVALID" instead of "BATT_TEMP_INVALID"?
Regards,
Kristof