mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: Re: [PATCH] ACPI / CPPC: Use 64-bit arithmetic instead of 32-bit
Date: Thu, 08 Feb 2018 10:49:47 +0100	[thread overview]
Message-ID: <2503109.MpnWDuSnnD@aspire.rjw.lan> (raw)
In-Reply-To: <20180206233617.GA30829@embeddedgus>

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!

  reply	other threads:[~2018-02-08  9:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 23:36 Gustavo A. R. Silva
2018-02-08  9:49 ` Rafael J. Wysocki [this message]
2018-02-08 16:40   ` Gustavo A. R. Silva

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=2503109.MpnWDuSnnD@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=garsilva@embeddedor.com \
    --cc=gustavo@embeddedor.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®