From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI / CPPC: Use 64-bit arithmetic instead of 32-bit
Date: Thu, 8 Feb 2018 10:40:38 -0600 [thread overview]
Message-ID: <1f5cffd5-4806-a8e6-48d7-bc2f8ec1d440@embeddedor.com> (raw)
In-Reply-To: <2503109.MpnWDuSnnD@aspire.rjw.lan>
On 02/08/2018 03:49 AM, Rafael J. Wysocki wrote:
> On Wednesday, February 7, 2018 12:36:17 AM CET Gustavo A. R. Silva wrote:
>> Add suffix ULL to constant 500 in order to give the compiler complete
>> information about the proper arithmetic to use. Notice that this
>> constant is used in a context that expects an expression of type
>> u64 (64 bits, unsigned).
>>
>> The expression NUM_RETRIES * cppc_ss->latency at line 578, which at
>> preprocessing time translates to 500 * cppc_ss->latency is currently
>> being evaluated using 32-bit arithmetic.
>>
>> Addresses-Coverity-ID: 1382602
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>> Notice that another option is to cast NUM_RETRIES to u64 at line 578,
>> but as there is only one instace in which this macro is being used I
>> think adding the ULL is just enough.
>>
>> drivers/acpi/cppc_acpi.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
>> index 06ea474..0afbb26 100644
>> --- a/drivers/acpi/cppc_acpi.c
>> +++ b/drivers/acpi/cppc_acpi.c
>> @@ -119,7 +119,7 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
>> * to PCC commands. Keeping it high enough to cover emulators where
>> * the processors run painfully slow.
>> */
>> -#define NUM_RETRIES 500
>> +#define NUM_RETRIES 500ULL
>>
>> struct cppc_attr {
>> struct attribute attr;
>>
>
> Applied, thanks!
>
>
Thank you, Rafael.
--
Gustavo
prev parent reply other threads:[~2018-02-08 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 23:36 [PATCH] ACPI / CPPC: Use 64-bit arithmetic instead of 32-bit Gustavo A. R. Silva
2018-02-08 9:49 ` Rafael J. Wysocki
2018-02-08 16:40 ` Gustavo A. R. Silva [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f5cffd5-4806-a8e6-48d7-bc2f8ec1d440@embeddedor.com \
--to=garsilva@embeddedor.com \
--cc=gustavo@embeddedor.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).