From 4d5587b21e4646b770398cabc1514acfa34110b3 Mon Sep 17 00:00:00 2001 From: Bora Guvendik Date: Wed, 29 Jan 2025 08:02:44 -0800 Subject: [PATCH] drivers/soc/cse: Fix overflow in CSE telemetry calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MSEC_TO_USEC(cse_perf_data.timestamp[i]) does overflow. Here is an example, if cse_perf_data.timestamp[i] value is 4304903 milliseconds. When multiplied by 1000 to convert to microseconds, the value becomes 0x979B58 instead of 0x100979B58. TEST=Boot to OS Change-Id: I09cc00aa595a821a57a34c38a4435e433e935ad3 Signed-off-by: Bora Guvendik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86215 Reviewed-by: Subrata Banik Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) Reviewed-by: Jérémy Compostella --- src/soc/intel/common/block/cse/telemetry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/soc/intel/common/block/cse/telemetry.c b/src/soc/intel/common/block/cse/telemetry.c index 2c9fb54581..62814eb006 100644 --- a/src/soc/intel/common/block/cse/telemetry.c +++ b/src/soc/intel/common/block/cse/telemetry.c @@ -4,7 +4,7 @@ #include #include -#define MSEC_TO_USEC(x) (x * 1000) +#define MSEC_TO_USEC(x) ((s64)x * 1000) enum cb_err cse_get_boot_performance_data(struct cse_boot_perf_rsp *boot_perf_rsp) {