From eabe778764e9c837a8d708063e6cd8aa8ba6ba94 Mon Sep 17 00:00:00 2001 From: Bo He Date: Sun, 12 Jan 2025 20:03:35 +0800 Subject: [PATCH] coverity: fix the Overflowed return value in msr.c coverity report the error: Event return_overflow: "status", which might have overflowed, is returned from the function. It's because msr_reg_read return u64 while the status return in process_args is int tpe. Tests Done: 1. Build and boot 2. peeknpoke function works Tracked-On: OAM-129214 Signed-off-by: Bo He --- msr.c | 2 +- pnp_utils_inc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/msr.c b/msr.c index ae73342..dbfc9fb 100644 --- a/msr.c +++ b/msr.c @@ -28,7 +28,7 @@ /* * This function reads from requested MSR address */ -uint64_t msr_reg_read(int cpu, unsigned int reg_offset, int print_enabled) +int msr_reg_read(int cpu, unsigned int reg_offset, int print_enabled) { char buf[128]; uint64_t temp = 0; diff --git a/pnp_utils_inc.h b/pnp_utils_inc.h index b6cf49d..a414890 100644 --- a/pnp_utils_inc.h +++ b/pnp_utils_inc.h @@ -54,7 +54,7 @@ int addr_range_dump(unsigned int target, unsigned int numOfWords); int reg_write(unsigned int target, unsigned int dataBitSize, unsigned int value); int reg_read(unsigned int target, unsigned int dataBitSize); -uint64_t msr_reg_read(int cpu, unsigned int reg_offset, int print_enabled); +int msr_reg_read(int cpu, unsigned int reg_offset, int print_enabled); int msr_reg_write(int cpu, unsigned int reg_offset, uint64_t value); int read_nc_port(int v, int port, int *ret_val);