Loading
crypto: qat - avoid division by zero
mainline inclusion from mainline-v6.9-rc1 commit f99fb7d660f7c818105803f1f1915396a14d18ad category: feature bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I9A5BW CVE: N/A Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f99fb7d660f7c818105803f1f1915396a14d18ad ------------------------------------- Check if delta_us is not zero and return -EINVAL if it is. delta_us is unlikely to be zero as there is a sleep between the reads of the two timestamps. This is to fix the following warning when compiling the QAT driver using clang scan-build: drivers/crypto/intel/qat/qat_common/adf_clock.c:87:9: warning: Division by zero [core.DivideZero] 87 | temp = DIV_ROUND_CLOSEST_ULL(temp, delta_us); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Intel-SIG: commit f99fb7d660f7 crypto: qat - avoid division by zero Backport to support QAT in-tree driver Fixes: e2980ba5 ("crypto: qat - add measure clock frequency") Signed-off-by:Adam Guerin <adam.guerin@intel.com> Reviewed-by:
Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by:
Herbert Xu <herbert@gondor.apana.org.au> [ Aichun Shi: amend commit log ] Signed-off-by:
Aichun Shi <aichun.shi@intel.com>