]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
KVM: S390: fix potential array overrun in intercept handling
authorChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 21 Jan 2010 11:19:07 +0000 (12:19 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Jan 2010 23:02:40 +0000 (15:02 -0800)
commit70be4d76c0e5d426067601a79be0b33ea673f3ff
tree0fb5576fd038e0025c12022c10c7dd7a754e1db2
parenteb6002526b1c5cb3e7f9e42004ba395f5d57beaf
KVM: S390: fix potential array overrun in intercept handling

commit 062d5e9b0d714f449b261bb522eadaaf6f00f438 upstream.

kvm_handle_sie_intercept uses a jump table to get the intercept handler
for a SIE intercept. Static code analysis revealed a potential problem:
the intercept_funcs jump table was defined to contain (0x48 >> 2) entries,
but we only checked for code > 0x48 which would cause an off-by-one
array overflow if code == 0x48.

Use the compiler and ARRAY_SIZE to automatically set the limits.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/s390/kvm/intercept.c