Blame SOURCES/oprofile-defaultmask.patch

e284e3
commit fb9529161039e96d44b4b7396450cff04e3d9aa8
e284e3
Author: Maynard Johnson <maynardj@us.ibm.com>
e284e3
Date:   Tue Oct 15 14:58:16 2013 -0500
e284e3
e284e3
    Fix operf/ocount default unit mask selection
e284e3
    
e284e3
    Many events (particularly in the x86* architectures)
e284e3
    require a unit mask value to specify the exact event
e284e3
    type.  For such events, a default unit mask value
e284e3
    is assigned.  When a user runs operf, ocount, or
e284e3
    opcontrol and specifies such an event but does not
e284e3
    specify a unit mask, the default unit mask should be
e284e3
    selected and used by the tool.  A bug was discovered
e284e3
    with operf and ocount where the unit mask value in
e284e3
    this situation was being set to '0' instead of the
e284e3
    default unit mask value.  This patch fixes the bug.
e284e3
    
e284e3
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
e284e3
e284e3
diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp
e284e3
index b85d175..177835e 100644
e284e3
--- a/libpe_utils/op_pe_utils.cpp
e284e3
+++ b/libpe_utils/op_pe_utils.cpp
e284e3
@@ -484,7 +484,8 @@ handle_named_um:
e284e3
 		pclose(fp);
e284e3
 		event->evt_um = strtoull(mask, &endptr, 10);
e284e3
 		if ((endptr >= mask) &&
e284e3
-				(endptr <= (mask + strlen(mask) - 1))) {
e284e3
+				(endptr <= (mask + strlen(mask) - 2))) { // '- 2' to account for linefeed and '\0'
e284e3
+
e284e3
 			// Must be a default named unit mask
e284e3
 			strncpy(event->um_name, mask, OP_MAX_UM_NAME_LEN);
e284e3
 			goto handle_named_um;