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

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 <adobriyan@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

authored by

Alexey Dobriyan and committed by
Jason A. Donenfeld
adcd7118 23a60a03

+1 -1
+1 -1
arch/x86/events/intel/p4.c
··· 24 24 unsigned int escr_msr[2]; /* ESCR MSR for this event */ 25 25 unsigned int escr_emask; /* valid ESCR EventMask bits */ 26 26 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 */ 28 28 }; 29 29 30 30 struct p4_pebs_bind {