Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[S390] oprofile s390: prevent stack corruption

Prevent stack corruption by memcpy which copies more bytes then
available at the destination. While at it use the new test_facility
to test for the facility bit.

Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Jan Glauber and committed by
Martin Schwidefsky
65a94b14 78fca1b9

+1 -5
+1 -5
arch/s390/oprofile/hwsampler.c
··· 517 517 518 518 static int check_hardware_prerequisites(void) 519 519 { 520 - unsigned long long facility_bits[2]; 521 - 522 - memcpy(facility_bits, S390_lowcore.stfle_fac_list, 32); 523 - if (!(facility_bits[1] & (1ULL << 59))) 520 + if (!test_facility(68)) 524 521 return -EOPNOTSUPP; 525 - 526 522 return 0; 527 523 } 528 524 /*