Re: [PATCH] kvm: x86: mmu: Add cast to negated bitmasks in update_permission_bitmask()

From: Matthias Kaehlcke
Date: Wed Jun 20 2018 - 19:00:26 EST


On Wed, Jun 20, 2018 at 10:02:15AM +0200, Paolo Bonzini wrote:
> On 20/06/2018 01:45, Matthias Kaehlcke wrote:
> >
> > v4.16 with an x86 allyesconfig and a few drivers disabled since they
> > don't build with clang (yet):
> >
> > 16 occurrences of -Wconstant-conversion, including the ones fixed by
> > this patch. Certainly no need for an endless churn of patches, and
> > given the limited number it also doesn't seem likely that new
> > instances will be added on a regular base.
>
> Thanks for providing numbers! The next question is: how many of these
> 16 occurrences are actual bugs?

Probably none.

> This is what measures the usefulness of the warning.

I very much doubt that this is a useful metric given the limited
number of occurrences.

Let's assume that 1 out of 20 patches not doing the cast have an
actual problem. For 16 occurrences this means there's a 44% chance
that none of these instances is an error (18.5% for 1 out 10). This
is without taking into account that some of the instances are in the
same file and likey similar (as in the KVM case), and that most of the
code has undergone years of testing in the field.