Browse Source

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>
Message-Id: <20150311111609.GG8544@dhcp-25-225.brq.redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Petr Matousek 10 năm trước cách đây
mục cha
commit
2dccb4cdbf
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      arch/x86/kvm/i8259.c

+ 1 - 0
arch/x86/kvm/i8259.c

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