From: Dan Carpenter <dan.carpenter@oracle.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>,
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: Wed, 12 Oct 2022 09:34:18 +0300 [thread overview]
Message-ID: <Y0Zf6g7ahY2b7MBK@kadam> (raw)
In-Reply-To: <2c36799c-af38-fed5-3f31-a8bde25368d7@redhat.com>
On Tue, Oct 11, 2022 at 03:02:28PM +0200, Paolo Bonzini wrote:
> 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.
Thanks for your feedback.
I could probably make a rule to ignore clock related stuff. That's
honestly been a known source of false positives for a while. I kind of
have the infrastructure so it's not super hard to do actually... I'll do
that.
regards,
dan carpenter
prev parent reply other threads:[~2022-10-12 6:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 14:15 [kbuild] arch/x86/kvm/x86.c:4988 kvm_arch_tsc_set_attr() warn: check for integer overflow 'offset' Dan Carpenter
2022-10-10 18:39 ` Sean Christopherson
2022-10-11 13:02 ` Paolo Bonzini
2022-10-12 6:34 ` Dan Carpenter [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=Y0Zf6g7ahY2b7MBK@kadam \
--to=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=pbonzini@redhat.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