Coverity: qm_vf_q_assign(): Error handling issues
Hello!
This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20200417 as part of the linux-next 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 Apr 2 14:53:02 2020 +0800
cd1b7ae3435c ("crypto: hisilicon - unify SR-IOV related codes into QM")
Coverity reported the following:
*** CID 1492651: Error handling issues (CHECKED_RETURN) /drivers/crypto/hisilicon/qm.c: 2317 in qm_vf_q_assign()
2311 for (i = 1; i <= num_vfs; i++) {
2312 if (i == num_vfs)
2313 q_num += remain_q_num % num_vfs;
2314 ret = hisi_qm_set_vft(qm, i, q_base, q_num);
2315 if (ret) {
2316 for (j = i; j > 0; j--)
vvv CID 1492651: Error handling issues (CHECKED_RETURN)
vvv Calling "hisi_qm_set_vft" without checking return value (as is done elsewhere 4 out of 5 times).
2317 hisi_qm_set_vft(qm, j, 0, 0);
2318 return ret;
2319 }
2320 q_base += q_num;
2321 }2322
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: 1492651 ("Error handling issues")
Thanks for your attention!
Signature · 1 line
Coverity-bot
Quoted 22 lines · coverity-bot
Hello!
This is an experimental semi-automated report about issues detected by Coverity from a scan of next-20200417 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scanYou're getting this email because you were associated with the identified lines of code (noted below) that were touched by commits:
Thu Apr 2 14:53:02 2020 +0800
cd1b7ae3435c("crypto: hisilicon - unify SR-IOV related codes into QM")Coverity reported the following:
*** CID 1492651: Error handling issues (
CHECKED_RETURN) /drivers/crypto/hisilicon/qm.c: 2317 inqm_vf_q_assign()2311 for (i = 1; i <= num_vfs; i++) { 2312 if (i == num_vfs) 2313 q_num += remain_q_num % num_vfs; 2314 ret = hisi_qm_set_vft(qm, i, q_base, q_num); 2315 if (ret) { 2316 for (j = i; j > 0; j--)
Quoted 3 lines
vvv CID 1492651: Error handling issues (
CHECKED_RETURN)
vvv Calling "hisi_qm_set_vft" without checking return value (as is done elsewhere 4 out of 5 times).
2317hisi_qm_set_vft(qm, j, 0, 0);
This is the rollback of previous hisi_qm_set_vft failure, We will not check the retrun again.
Thanks,
Shukun
Quoted 17 lines
2318 return ret; 2319 } 2320 q_base += q_num; 2321 }2322
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 protected]>Addresses-Coverity-ID: 1492651 ("Error handling issues")
Fixes cd1b7ae3435c ("crypto: hisilicon - unify SR-IOV related codes into QM")Thanks for your attention!