[S390] oprofile s390: prevent stack corruption
authorJan Glauber <jang@linux.vnet.ibm.com>
Mon, 4 Apr 2011 07:43:29 +0000 (09:43 +0200)
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>
Mon, 4 Apr 2011 07:43:32 +0000 (09:43 +0200)
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>
arch/s390/oprofile/hwsampler.c

index 3d48f4d..4952872 100644 (file)
@@ -517,12 +517,8 @@ stop_exit:
 
 static int check_hardware_prerequisites(void)
 {
-       unsigned long long facility_bits[2];
-
-       memcpy(facility_bits, S390_lowcore.stfle_fac_list, 32);
-       if (!(facility_bits[1] & (1ULL << 59)))
+       if (!test_facility(68))
                return -EOPNOTSUPP;
-
        return 0;
 }
 /*