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

2018-06-26 Thread Paolo Bonzini
On 25/06/2018 19:35, Matthias Kaehlcke wrote: > commit e2a5dca753d1cdc3212519023ed8a13e13f5495b > Author: Borislav Petkov > Date: Thu Nov 23 10:19:51 2017 +0100 > > x86/umip: Fix insn_get_code_seg_params()'s return value So this is the closest thing to a bug (it could have been a real bug

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

2018-06-26 Thread Paolo Bonzini
On 25/06/2018 19:35, Matthias Kaehlcke wrote: > commit e2a5dca753d1cdc3212519023ed8a13e13f5495b > Author: Borislav Petkov > Date: Thu Nov 23 10:19:51 2017 +0100 > > x86/umip: Fix insn_get_code_seg_params()'s return value So this is the closest thing to a bug (it could have been a real bug

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

2018-06-25 Thread Nick Desaulniers
On Mon, Jun 25, 2018 at 1:50 PM Joe Perches wrote: > > On Mon, 2018-06-25 at 10:35 -0700, Matthias Kaehlcke wrote: > > Some other instances of the warning that have been addressed are: > > commit 644d87dccdc69cf79834a72ed0c889580d6af32a > > commit e2a5dca753d1cdc3212519023ed8a13e13f5495b > >

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

2018-06-25 Thread Nick Desaulniers
On Mon, Jun 25, 2018 at 1:50 PM Joe Perches wrote: > > On Mon, 2018-06-25 at 10:35 -0700, Matthias Kaehlcke wrote: > > Some other instances of the warning that have been addressed are: > > commit 644d87dccdc69cf79834a72ed0c889580d6af32a > > commit e2a5dca753d1cdc3212519023ed8a13e13f5495b > >

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

2018-06-25 Thread Joe Perches
On Mon, 2018-06-25 at 10:35 -0700, Matthias Kaehlcke wrote: > Some other instances of the warning that have been addressed are: > commit 644d87dccdc69cf79834a72ed0c889580d6af32a > commit e2a5dca753d1cdc3212519023ed8a13e13f5495b > commit dae1a432ab1fe79ae53129ededeaece35a2dc14d > commit

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

2018-06-25 Thread Joe Perches
On Mon, 2018-06-25 at 10:35 -0700, Matthias Kaehlcke wrote: > Some other instances of the warning that have been addressed are: > commit 644d87dccdc69cf79834a72ed0c889580d6af32a > commit e2a5dca753d1cdc3212519023ed8a13e13f5495b > commit dae1a432ab1fe79ae53129ededeaece35a2dc14d > commit

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

2018-06-25 Thread Matthias Kaehlcke
Hi Paolo, On Mon, Jun 25, 2018 at 06:05:01PM +0200, Paolo Bonzini wrote: > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > 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

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

2018-06-25 Thread Matthias Kaehlcke
Hi Paolo, On Mon, Jun 25, 2018 at 06:05:01PM +0200, Paolo Bonzini wrote: > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > 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

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

2018-06-25 Thread Joe Perches
On Mon, 2018-06-25 at 13:12 -0400, Nick Desaulniers wrote: > On Mon, Jun 25, 2018 at 1:05 PM Joe Perches wrote: > > On Mon, 2018-06-25 at 12:47 -0400, Nick Desaulniers wrote: [] > > > Here's an actual bug this warning caught applied to drivers/input/: > > > > > > dae1a432ab1f ("Input: mousedev -

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

2018-06-25 Thread Joe Perches
On Mon, 2018-06-25 at 13:12 -0400, Nick Desaulniers wrote: > On Mon, Jun 25, 2018 at 1:05 PM Joe Perches wrote: > > On Mon, 2018-06-25 at 12:47 -0400, Nick Desaulniers wrote: [] > > > Here's an actual bug this warning caught applied to drivers/input/: > > > > > > dae1a432ab1f ("Input: mousedev -

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

2018-06-25 Thread Nick Desaulniers
On Mon, Jun 25, 2018 at 1:05 PM Joe Perches wrote: > > On Mon, 2018-06-25 at 12:47 -0400, Nick Desaulniers wrote: > > On Mon, Jun 25, 2018 at 12:05 PM Paolo Bonzini wrote: > > > > > > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > > > update_permission_bitmask() negates u8 bitmask values and

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

2018-06-25 Thread Nick Desaulniers
On Mon, Jun 25, 2018 at 1:05 PM Joe Perches wrote: > > On Mon, 2018-06-25 at 12:47 -0400, Nick Desaulniers wrote: > > On Mon, Jun 25, 2018 at 12:05 PM Paolo Bonzini wrote: > > > > > > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > > > update_permission_bitmask() negates u8 bitmask values and

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

2018-06-25 Thread Joe Perches
On Mon, 2018-06-25 at 12:47 -0400, Nick Desaulniers wrote: > On Mon, Jun 25, 2018 at 12:05 PM Paolo Bonzini wrote: > > > > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > > update_permission_bitmask() negates u8 bitmask values and assigns them > > > to variables of type u8. Since the MSB is

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

2018-06-25 Thread Joe Perches
On Mon, 2018-06-25 at 12:47 -0400, Nick Desaulniers wrote: > On Mon, Jun 25, 2018 at 12:05 PM Paolo Bonzini wrote: > > > > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > > update_permission_bitmask() negates u8 bitmask values and assigns them > > > to variables of type u8. Since the MSB is

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

2018-06-25 Thread Paolo Bonzini
On 25/06/2018 18:47, Nick Desaulniers wrote: > Here's an actual bug this warning caught applied to drivers/input/: > > dae1a432ab1f ("Input: mousedev - fix implicit conversion warning"): > https://patchwork.kernel.org/patch/9753771/ > How does the warning catch a bug there? While I do prefer

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

2018-06-25 Thread Paolo Bonzini
On 25/06/2018 18:47, Nick Desaulniers wrote: > Here's an actual bug this warning caught applied to drivers/input/: > > dae1a432ab1f ("Input: mousedev - fix implicit conversion warning"): > https://patchwork.kernel.org/patch/9753771/ > How does the warning catch a bug there? While I do prefer

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

2018-06-25 Thread Nick Desaulniers
On Mon, Jun 25, 2018 at 12:05 PM Paolo Bonzini wrote: > > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > 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

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

2018-06-25 Thread Nick Desaulniers
On Mon, Jun 25, 2018 at 12:05 PM Paolo Bonzini wrote: > > On 19/06/2018 21:25, Matthias Kaehlcke wrote: > > 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

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

2018-06-25 Thread Paolo Bonzini
On 19/06/2018 21:25, Matthias Kaehlcke wrote: > 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

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

2018-06-25 Thread Paolo Bonzini
On 19/06/2018 21:25, Matthias Kaehlcke wrote: > 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

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

2018-06-25 Thread David Laight
From: Matthias Kaehlcke > Sent: 19 June 2018 20:25 > To: Paolo Bonzini; Radim Krčmář; Thomas Gleixner; H . Peter Anvin > Cc: x...@kernel.org; k...@vger.kernel.org; linux-kernel@vger.kernel.org; Nick > Desaulniers; Joe Perches; > Matthias Kaehlcke > Subject: [PATCH v2] kvm:

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

2018-06-25 Thread David Laight
From: Matthias Kaehlcke > Sent: 19 June 2018 20:25 > To: Paolo Bonzini; Radim Krčmář; Thomas Gleixner; H . Peter Anvin > Cc: x...@kernel.org; k...@vger.kernel.org; linux-kernel@vger.kernel.org; Nick > Desaulniers; Joe Perches; > Matthias Kaehlcke > Subject: [PATCH v2] kvm:

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

2018-06-19 Thread Matthias Kaehlcke
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

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

2018-06-19 Thread Matthias Kaehlcke
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