From patchwork Tue Oct 18 11:22:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 617056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7179FC4332F for ; Tue, 18 Oct 2022 11:16:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbiJRLQc (ORCPT ); Tue, 18 Oct 2022 07:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbiJRLQc (ORCPT ); Tue, 18 Oct 2022 07:16:32 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C5551EA; Tue, 18 Oct 2022 04:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666091791; x=1697627791; h=from:to:cc:subject:date:message-id; bh=pA0PdqTHxsHL7/a/8drLbW+gda7QFfqXPuVNuMwE6kQ=; b=kcniZT7jON9eWYaJZRDgzpYJEkLYg9lreVYaLLbIYHQjlTNuCZEDjfKL kh++RGhtTi4u0PmpD4IbW+urR512ftexygXRKAYh2RFkCOS9naqzR+cbz HVGDgnS9piaX6bei0cJBfcDdW9k3S868WycGnfi/gm3JKLhCgMIAE2ijo RKzT5SPLG9b89AktI4uwpQ/kmVCuU9eOhzgAC0Q7T75CGASGBNBDS67f7 LIKkI5y7EHY4TcdIkwFj7kMIlt5qGdTssbFagWQKTy5Svl6vIjEBq91Jb 3pLMIuVE2sibLK+BmrmU1pvopQR1gREo9PKUPsRXpMGF3kcH8gKj9+uWe g==; X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="370272282" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="370272282" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 04:16:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10503"; a="957724705" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="957724705" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga005.fm.intel.com with ESMTP; 18 Oct 2022 04:16:30 -0700 From: Ricardo Neri To: "Rafael J. Wysocki" Cc: Ricardo Neri , "Ravi V. Shankar" , Ricardo Neri , Daniel Lezcano , Amit Kucheria , Zhang Rui , Len Brown , Srinivas Pandruvada , Aubrey Li , Haowen Bai , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: intel: hfi: Improve the type of hfi_features::nr_table_pages Date: Tue, 18 Oct 2022 04:22:40 -0700 Message-Id: <20221018112240.25647-1-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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(). Cc: Daniel Lezcano Cc: Amit Kucheria Cc: Zhang Rui Cc: Len Brown Cc: Srinivas Pandruvada Cc: Aubrey Li Cc: Haowen Bai Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ricardo Neri --- drivers/thermal/intel/intel_hfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index a0640f762dc5..239afe02e518 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c @@ -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; };