Blame SOURCES/oprofile-maskarray.patch

c532ac
commit ef501aa609f49c06df9f33c9a7330dffd71b31b3
c532ac
Author: Maynard Johnson <maynardj@us.ibm.com>
c532ac
Date:   Thu Oct 31 11:11:06 2013 -0500
c532ac
c532ac
    Fix handling of default named unit masks longer than 11 chars
c532ac
    
c532ac
    The handling of default unit masks that are names instead of hex
c532ac
    values is new with oprofile 0.9.9. I've discovered a bug in this
c532ac
    handling when the name exceeds 11 characters. For example, on
c532ac
    Sandybridge, the following ocount command fails:
c532ac
    
c532ac
    [mpjohn@oc1757000783 test-stuff]$ ocount -e l1d_blocks ls
c532ac
    Cannot find unit mask bank_confli for l1d_blocks
c532ac
    Unable to find unit mask info for bank_confli for event l1d_blocks
c532ac
    
c532ac
    This problem was due to the char array ('mask') being too small.
c532ac
    
c532ac
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
c532ac
c532ac
diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp
c532ac
index 177835e..9e2addb 100644
c532ac
--- a/libpe_utils/op_pe_utils.cpp
c532ac
+++ b/libpe_utils/op_pe_utils.cpp
c532ac
@@ -413,8 +413,8 @@ static void _get_event_code(operf_event_t * event, op_cpu cpu_type)
c532ac
 
c532ac
 
c532ac
 #if defined(__i386__) || defined(__x86_64__)
c532ac
+	char mask[OP_MAX_UM_NAME_LEN];
c532ac
 	// Setup EventSelct[11:8] field for AMD
c532ac
-	char mask[12];
c532ac
 	const char * vendor_AMD = "AuthenticAMD";
c532ac
 	if (op_is_cpu_vendor((char *)vendor_AMD)) {
c532ac
 		config = base_code & 0xF00ULL;