Subrata Banik has submitted this change. ( https://review.coreboot.org/c/coreboot/+/86215?usp=email )
Change subject: drivers/soc/cse: Fix overflow in CSE telemetry calculation ......................................................................
drivers/soc/cse: Fix overflow in CSE telemetry calculation
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 bora.guvendik@intel.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/86215 Reviewed-by: Subrata Banik subratabanik@google.com Reviewed-by: Kapil Porwal kapilporwal@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Jérémy Compostella jeremy.compostella@intel.com --- M src/soc/intel/common/block/cse/telemetry.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Kapil Porwal: Looks good to me, approved Jérémy Compostella: Looks good to me, but someone else must approve Subrata Banik: Looks good to me, approved
diff --git a/src/soc/intel/common/block/cse/telemetry.c b/src/soc/intel/common/block/cse/telemetry.c index 2c9fb54..62814eb 100644 --- a/src/soc/intel/common/block/cse/telemetry.c +++ b/src/soc/intel/common/block/cse/telemetry.c @@ -4,7 +4,7 @@ #include <intelblocks/cse.h> #include <timestamp.h>
-#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) {