soc: qcom: Introduce Protection Domain Restart helpers
Hello Sibi Sankar,
The patch fbe639b44a82: "soc: qcom: Introduce Protection Domain Restart helpers" from Mar 12, 2020, leads to the following static checker warning:
drivers/soc/qcom/pdr_interface.c:158 pdr_register_listener() warn: impossible condition '(resp.curr_state < (-((~0 >> 1)) - 1)) => (s32min-s32max < s32min)'
drivers/soc/qcom/pdr_interface.c
145 ret = qmi_txn_wait(&txn, 5 * HZ);
146 if (ret < 0) {
147 pr_err("PDR: %s register listener txn wait failed: %d\n",
148 pds->service_path, ret);
149 return ret;
150 }
151
152 if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
153 pr_err("PDR: %s register listener failed: 0x%x\n",
154 pds->service_path, resp.resp.error);
155 return ret;
156 }
157
158 if ((int)resp.curr_state < INT_MIN || (int)resp.curr_state > INT_MAX)
^^^^ ^^^^
These are casted to int so they can't be outside of int range.
159 pr_err("PDR: %s notification state invalid: 0x%x\n",
160 pds->service_path, resp.curr_state);
161
162 pds->state = resp.curr_state;
163
164 return 0;
165 }
regards,
dan carpenter
Hey Dan,
Thanks for the bug report!
Will get the warning fixed
Quoted 42 lines · Dan Carpenter
Hello Sibi Sankar,
The patch
fbe639b44a82: "soc: qcom: Introduce Protection Domain Restart helpers" from Mar 12, 2020, leads to the following static checker warning:drivers/soc/qcom/pdr_interface.c:158 pdr_register_listener() warn: impossible condition '(resp.curr_state < (-((~0 >> 1)) - 1)) =>(s32min-s32max < s32min)'
drivers/soc/qcom/pdr_interface.c
145 ret =qmi_txn_wait(&txn, 5 * HZ);
146 if (ret < 0) {
147 pr_err("PDR: %s register listener txn wait
failed: %d\n",148 pds->service_path, ret); 149 return ret; 150 } 151 152 if (resp.resp.result != QMI_RESULT_SUCCESS_V01) { 153 pr_err("PDR: %s register listener failed: 0x%x\n", 154 pds->service_path, resp.resp.error); 155 return ret; 156 } 157 158 if ((int)resp.curr_state < INT_MIN ||(int)resp.curr_state >
INT_MAX)
^^^^ ^^^^
These are casted to int so they can't be outside of int range.159 pr_err("PDR: %s notification state invalid:
0x%x\n",160 pds->service_path, resp.curr_state); 161 162 pds->state = resp.curr_state; 163 164 return 0; 165 }regards,
dan carpenter
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.