Subject: Coverity: pdr_register_listener(): Integer handling issues

From: coverity-bot <[email-masked]>
Date: Mon, 13 Apr 2020 09:23:22 -0700

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):

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1461652 ("Integer handling issues")
Fixes: fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers")

Thanks for your attention!

-- 
Coverity-bot