kvm: x86: i8259: return initialized data on invalid-size read

If data is read from PIC with invalid access size, the return data stays
uninitialized even though success is returned.

Fix this by always initializing the data.

Signed-off-by: Petr Matousek <pmatouse@redhat.com>
Reported-by: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Petr Matousek 2015-03-11 12:16:09 +01:00 committed by Marcelo Tosatti
parent dc9be0fac7
commit c1a6bff28c
1 changed files with 1 additions and 0 deletions

View File

@ -507,6 +507,7 @@ static int picdev_read(struct kvm_pic *s,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (len != 1) { if (len != 1) {
memset(val, 0, len);
pr_pic_unimpl("non byte read\n"); pr_pic_unimpl("non byte read\n");
return 0; return 0;
} }