Message ID | 20221018112240.25647-1-ricardo.neri-calderon@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1901027wrs; Tue, 18 Oct 2022 04:22:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5L8V8DIMo3eKz2S4NHYjKatUziVcNQtintUKYnlMiFxnphzipDWkHn/XsC87I64fQAPr88 X-Received: by 2002:a63:4426:0:b0:464:4e1d:80e3 with SMTP id r38-20020a634426000000b004644e1d80e3mr2253713pga.106.1666092157600; Tue, 18 Oct 2022 04:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666092157; cv=none; d=google.com; s=arc-20160816; b=bbw3HC9i8k3HDzH69mN90cKlkIZ1qDj1qjXQF8P6asK2epN098Wa3QSHnXQ6PP8M59 zgoy45922iFNO/bo+kndD2rWGkwivtgJlC+G0NdhZf/llV1avBinyHZWBpYeqVaK7hY0 71r4Wmnc9YJKAJlGdj6k4GPPSS5+jI1lPfHh1mEnUMFRVt4zoUsAHcfhVNU8Pk3j1sdo YrtOXqBrJxcE1ez9sDLmFswLG2U/IVyafg0eACa6EWQjuPGtIwSR0EjVkTFdHh74GU81 nS258ZuzlvR6kNdMTEu8B1i+hiHaMq4jceI3vxOSjA/SURVEd74G90anyua+EEmQfvaq jCfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=iNm3obEWy+Z95cyMT6bCWIcG951/ymuLkuZZlp5qDjE=; b=M8WqKxlnkxY/4EjWJLjA4jDIvmu3tc8Eg2ZSfPkcfG0j/X/n1oE8EGiHmRokL4QaqP FA0Fkaw4XEl8ZhxTd1OE0W0pJ3uCl0YLlymA+NW3HU+FFfAo8MjphjSwQhSiS0NJfXtL 5gfQMvI9Qk9jW8VaOGk6tpc14bMOTGeOhn2yXK3hoJDIP96Qhz7b3HmS0nG0WHhGUs24 ujqqfHOXZmjcVVmxIlGfJfG4UiRlwDKnY9jIwL/vlFprVdicalNFrO5VwjDoQBes6Brz mB64LrYsLL0TTjALN/cWncGVW2GqQCoqdD6CPgHQQzIxYy9EJT7yYtVL4K5HZVLssrP0 ipzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kcniZT7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a056a00150e00b005631ca6aad7si15345759pfu.258.2022.10.18.04.22.22; Tue, 18 Oct 2022 04:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kcniZT7j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbiJRLQd (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Tue, 18 Oct 2022 07:16:33 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <ricardo.neri-calderon@linux.intel.com> To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Cc: Ricardo Neri <ricardo.neri@intel.com>, "Ravi V. Shankar" <ravi.v.shankar@intel.com>, Ricardo Neri <ricardo.neri-calderon@linux.intel.com>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Len Brown <len.brown@intel.com>, Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>, Aubrey Li <aubrey.li@linux.intel.com>, Haowen Bai <baihaowen@meizu.com>, 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 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747024250269081893?= X-GMAIL-MSGID: =?utf-8?q?1747024250269081893?= |
Series |
thermal: intel: hfi: Improve the type of hfi_features::nr_table_pages
|
|
Commit Message
Ricardo Neri
Oct. 18, 2022, 11:22 a.m. UTC
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 <daniel.lezcano@linaro.org>
Cc: Amit Kucheria <amitk@kernel.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Aubrey Li <aubrey.li@linux.intel.com>
Cc: Haowen Bai <baihaowen@meizu.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
drivers/thermal/intel/intel_hfi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Oct 18, 2022 at 1:16 PM Ricardo Neri <ricardo.neri-calderon@linux.intel.com> wrote: > > 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 <daniel.lezcano@linaro.org> > Cc: Amit Kucheria <amitk@kernel.org> > Cc: Zhang Rui <rui.zhang@intel.com> > Cc: Len Brown <len.brown@intel.com> > Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> > Cc: Aubrey Li <aubrey.li@linux.intel.com> > Cc: Haowen Bai <baihaowen@meizu.com> > Cc: linux-pm@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> > --- > 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; > }; > -- Applied as 6.2 material, thanks!
On Fri, Oct 28, 2022 at 08:13:15PM +0200, Rafael J. Wysocki wrote: > On Tue, Oct 18, 2022 at 1:16 PM Ricardo Neri > <ricardo.neri-calderon@linux.intel.com> wrote: > > > > 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 <daniel.lezcano@linaro.org> > > Cc: Amit Kucheria <amitk@kernel.org> > > Cc: Zhang Rui <rui.zhang@intel.com> > > Cc: Len Brown <len.brown@intel.com> > > Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> > > Cc: Aubrey Li <aubrey.li@linux.intel.com> > > Cc: Haowen Bai <baihaowen@meizu.com> > > Cc: linux-pm@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> > > --- > > 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; > > }; > > -- > > Applied as 6.2 material, thanks! Thank you Rafael!
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; };