diff mbox

fuzz/x86emul: remove bogus check against fuzzer msr index

Message ID 20170207110240.18478-1-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Feb. 7, 2017, 11:02 a.m. UTC
The "reg" variable in fuzz_read_msr stores the real MSR index, not an
index within the fuzzer.

The rest of that function already handles things correctly. We just need
to remove the bogus check.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Andrew Cooper Feb. 7, 2017, 11:03 a.m. UTC | #1
On 07/02/17 11:02, Wei Liu wrote:
> The "reg" variable in fuzz_read_msr stores the real MSR index, not an
> index within the fuzzer.
>
> The rest of that function already handles things correctly. We just need
> to remove the bogus check.

"Spotted by Coverity."

> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

> ---
>  tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
> index 3b6d33aa25..4a2bdbe392 100644
> --- a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
> +++ b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
> @@ -347,9 +347,6 @@ static int fuzz_read_msr(
>  {
>      unsigned int idx;
>  
> -    if ( reg >= MSR_INDEX_MAX )
> -        return X86EMUL_UNHANDLEABLE;
> -
>      switch ( reg )
>      {
>      case MSR_TSC_AUX:
Wei Liu Feb. 8, 2017, 9:33 a.m. UTC | #2
On Tue, Feb 07, 2017 at 11:03:57AM +0000, Andrew Cooper wrote:
> On 07/02/17 11:02, Wei Liu wrote:
> > The "reg" variable in fuzz_read_msr stores the real MSR index, not an
> > index within the fuzzer.
> >
> > The rest of that function already handles things correctly. We just need
> > to remove the bogus check.
> 
> "Spotted by Coverity."
> 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 

Applied.
diff mbox

Patch

diff --git a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
index 3b6d33aa25..4a2bdbe392 100644
--- a/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
+++ b/tools/fuzz/x86_instruction_emulator/x86-insn-emulator-fuzzer.c
@@ -347,9 +347,6 @@  static int fuzz_read_msr(
 {
     unsigned int idx;
 
-    if ( reg >= MSR_INDEX_MAX )
-        return X86EMUL_UNHANDLEABLE;
-
     switch ( reg )
     {
     case MSR_TSC_AUX: