mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Cc: kbuild@lists.01.org, Oliver Upton <oupton@google.com>,
	lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: Re: [kbuild] arch/x86/kvm/x86.c:4988 kvm_arch_tsc_set_attr() warn: check for integer overflow 'offset'
Date: Tue, 11 Oct 2022 15:02:28 +0200	[thread overview]
Message-ID: <2c36799c-af38-fed5-3f31-a8bde25368d7@redhat.com> (raw)
In-Reply-To: <Y0Rm/Y5flhd734NX@google.com>

On 10/10/22 20:39, Sean Christopherson wrote:
>> 828ca89628bfcb Oliver Upton 2021-09-16 @4988  		tsc = kvm_scale_tsc(vcpu, rdtsc(), vcpu->arch.l1_tsc_scaling_ratio) + offset;
>>
>> Smatch hates obvious user triggerable integer overflows...  No checking
>> on offset.
>
> This is ok, and even necessary, e.g. if the host TSC > guest TSC.

(which in fact is the common case).  Also this is unsigned which is fine 
according to the C standard, though I understand that static analyzers 
want to be stricter.

> Is there anything
> we can do in KVM to help Smatch avoid false positives?  Or do you/Smatch already
> maintain a list of known false positives?

Seconded.

Paolo


  reply	other threads:[~2022-10-11 13:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-10 14:15 Dan Carpenter
2022-10-10 18:39 ` Sean Christopherson
2022-10-11 13:02   ` Paolo Bonzini [this message]
2022-10-12  6:34     ` Dan Carpenter

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=2c36799c-af38-fed5-3f31-a8bde25368d7@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oupton@google.com \
    --cc=seanjc@google.com \
    /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

Powered by JetHome