diff options
author | Dave Martin <[email protected]> | 2019-04-11 16:37:38 +0100 |
---|---|---|
committer | Marc Zyngier <[email protected]> | 2019-04-18 17:14:01 +0100 |
commit | 55ffad3b636a32dae03752078f4a0846bfd3a151 (patch) | |
tree | f0cf6afc486239d4b1d7608d6d529b2ebffc1083 /net/lapb/lapb_in.c | |
parent | 52110aa95948deba724739fc9933070c3e2c7239 (diff) |
KVM: arm64/sve: WARN when avoiding divide-by-zero in sve_reg_to_region()
sve_reg_to_region() currently passes the result of
vcpu_sve_state_size() to array_index_nospec(), effectively
leading to a divide / modulo operation.
Currently the code bails out and returns -EINVAL if
vcpu_sve_state_size() turns out to be zero, in order to avoid going
ahead and attempting to divide by zero. This is reasonable, but it
should only happen if the kernel contains some other bug that
allowed this code to be reached without the vcpu having been
properly initialised.
To make it clear that this is a defence against bugs rather than
something that the user should be able to trigger, this patch marks
the check with WARN_ON().
Suggested-by: Andrew Jones <[email protected]>
Signed-off-by: Dave Martin <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Diffstat (limited to 'net/lapb/lapb_in.c')
0 files changed, 0 insertions, 0 deletions