Skip to content

Commit adcd711

Browse files
Alexey Dobriyanzx2c4
authored andcommitted
perf/x86: Make struct p4_event_bind::cntr signed array
struct p4_event_bind::cntr[][] should be signed because of the following code: int i, j; for (i = 0; i < P4_CNTR_LIMIT; i++) { ---> j = bind->cntr[thread][i]; if (j != -1 && !test_bit(j, used_mask)) return j; } Making this member unsigned will make "j" 255 and fail "j != -1" comparison. Signed-off-by: Alexey Dobriyan <[email protected]> Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 23a60a0 commit adcd711

File tree

1 file changed

+1
-1
lines changed
  • arch/x86/events/intel

1 file changed

+1
-1
lines changed

arch/x86/events/intel/p4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct p4_event_bind {
2424
unsigned int escr_msr[2]; /* ESCR MSR for this event */
2525
unsigned int escr_emask; /* valid ESCR EventMask bits */
2626
unsigned int shared; /* event is shared across threads */
27-
char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on absence */
27+
signed char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on absence */
2828
};
2929

3030
struct p4_pebs_bind {

0 commit comments

Comments
 (0)