lkml.org 
[lkml]   [2022]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [kbuild] arch/x86/kvm/x86.c:4988 kvm_arch_tsc_set_attr() warn: check for integer overflow 'offset'
From
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

\
 
 \ /
  Last update: 2022-10-11 15:03    [W:0.045 / U:1.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site