[Accel-config] [PATCH v2] accel-config/test: Fix descriptor timeout calculation to not overflow
Dave Jiang <dave.jiang at intel.com> Thu, 28 Apr 2022 08:48:58 -0700
| Newsgroups | dev.linux.lists.accel-config |
|---|---|
| Message-ID | < <165116086400.48832.7505483597117381921.stgit@djiang5-desk3.ch.intel.com>> |
Testing has shown that when using large transfer size, the mwait value is
not working correctly. The dsa_test application will fail due to constant
value converted by compiler to integer and cause the math to overflow on
large values. Explicitly declare constant to UL in order to force type
casting of unsigned long. Also, the calculation should use the passed in
timeout parameter and not the global constant.
Signed-off-by: Ken Buchanan <kenneth.buchanan(a)intel.com>
Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
Reviewed-by: Dave Jiang <dave.jiang(a)intel.com>
---
v2:
- Fixed up commit subject and commit log (Dave)
- Resend for Tony with the added sign-off tags
test/accel_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/accel_test.c b/test/accel_test.c
index 84870996ac68..84ab13e77fa5 100644
--- a/test/accel_test.c
+++ b/test/accel_test.c
@@ -331,7 +331,7 @@ int acctest_wait_on_desc_timeout(struct completion_record *comp,
j++;
}
} else {
- unsigned long timeout = (ms_timeout * 1000000) * 3;
+ unsigned long timeout = (msec_timeout * 1000000UL) * 3;
int r = 1;
unsigned long t = 0;