[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea5b51cbdb8a4a2fa8ef51e6de68d960@AcuMS.aculab.com>
Date: Mon, 25 Jun 2018 16:02:40 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Matthias Kaehlcke' <mka@...omium.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
"H . Peter Anvin" <hpa@...or.com>
CC: "x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Joe Perches <joe@...ches.com>
Subject: RE: [PATCH v2] kvm: x86: mmu: Add cast to negated bitmasks in
update_permission_bitmask()
From: Matthias Kaehlcke
> Sent: 19 June 2018 20:25
> To: Paolo Bonzini; Radim Krčmář; Thomas Gleixner; H . Peter Anvin
> Cc: x86@...nel.org; kvm@...r.kernel.org; linux-kernel@...r.kernel.org; Nick Desaulniers; Joe Perches;
> Matthias Kaehlcke
> Subject: [PATCH v2] kvm: x86: mmu: Add cast to negated bitmasks in update_permission_bitmask()
>
> update_permission_bitmask() negates u8 bitmask values and assigns them
> to variables of type u8. Since the MSB is set in the bitmask values the
> compiler expands the negated values to int, which then is assigned to
> an u8 variable. Cast the negated value back to u8.
>
> This fixes several warnings like this when building with clang:
>
> arch/x86/kvm/mmu.c:4266:39: error: implicit conversion from 'int' to 'u8'
> (aka 'unsigned char') changes value from -205 to 51 [-Werror,
> -Wconstant-conversion]
> u8 wf = (pfec & PFERR_WRITE_MASK) ? ~w : 0;
> ~~ ^~
Shoot the compiler writer - or turn off that warning.
Or try 'w ^ 0xff'.
David
Powered by blists - more mailing lists