Skip to content

Commit

Permalink
thermal: intel: hfi: Improve the type of hfi_features::nr_table_pages
Browse files Browse the repository at this point in the history
A Coverity static code scan raised a potential overflow_before_widen
warning when hfi_features::nr_table_pages is used as an argument to
memcpy in intel_hfi_process_event().

Even though the overflow can never happen (the maximum number of pages of
the HFI table is 0x10 and 0x10 << PAGE_SHIFT = 0x10000), using size_t as
the data type of hfi_features::nr_table_pages makes Coverity happy and
matches the data type of the argument 'size' of memcpy().

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Ricardo Neri authored and Rafael J. Wysocki committed Oct 28, 2022
1 parent 247f34f commit 54d9135
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thermal/intel/intel_hfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ struct hfi_instance {
* Parameters and supported features that are common to all HFI instances
*/
struct hfi_features {
unsigned int nr_table_pages;
size_t nr_table_pages;
unsigned int cpu_stride;
unsigned int hdr_size;
};
Expand Down

0 comments on commit 54d9135

Please sign in to comment.