]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: use struct_size() and flex_array_size() helpers in kvm_io_bus_unregister_dev()
authorRustam Kovhaev <rkovhaev@gmail.com>
Fri, 18 Sep 2020 12:05:00 +0000 (05:05 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Sep 2020 11:57:17 +0000 (07:57 -0400)
commitf2e47328a852787a2551a4d1d8197bd249da6083
tree4119e67682745c57af5cd6e1426f1312cabce2b1
parent3a2b9f20e8e75e073e81c1b629712c5b7ceb22bf
KVM: use struct_size() and flex_array_size() helpers in kvm_io_bus_unregister_dev()

Make use of the struct_size() helper to avoid any potential type
mistakes and protect against potential integer overflows
Make use of the flex_array_size() helper to calculate the size of a
flexible array member within an enclosing structure

Suggested-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
Message-Id: <20200918120500.954436-1-rkovhaev@gmail.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c