Skip to contentSkip to conversation

Coverity: pdr_register_listener(): Integer handling issues

DISCUSSION coverity-bot 1 participant 1 message Apr 13, 2020 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hello!

This is an experimental automated report about issues detected by Coverity from a scan of next-20200413 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:

Thu Mar 12 17:38:40 2020 +0530
fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers")

Coverity reported the following:

*** CID 1461652: Integer handling issues (CONSTANT_EXPRESSION_RESULT) /drivers/soc/qcom/pdr_interface.c: 158 in pdr_register_listener()

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
vvv     CID 1461652:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
vvv     "(int)resp.curr_state < -2147483648 /* -((int)(~0U >> 1)) - 1 */" is always false regardless of the values of its operands. This occurs as the logical first operand of "||".
158     	if ((int)resp.curr_state < INT_MIN || (int)resp.curr_state > INT_MAX)
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

If this is a false positive, please let us know so we can mark it as such, or teach the Coverity rules to be smarter. If not, please make sure fixes get into linux-next. :) For patches fixing this, please include these lines (but double-check the "Fixes" first):

Addresses-Coverity-ID: 1461652 ("Integer handling issues")

Fixes fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers")

Thanks for your attention!

Signature · 1 line
Coverity-bot