Skip to content

Commit 32dab68

Browse files
Thomas RichterVasily Gorbik
authored andcommitted
s390/cpum_sf: Use kzalloc and minor changes
Use kzalloc() to allocate auxiliary buffer structure initialized with all zeroes to avoid random value in trace output. Avoid double access to SBD hardware flags. Signed-off-by: Thomas Richter <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent ee5c4cc commit 32dab68

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/s390/kernel/perf_cpum_sf.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,8 +1426,8 @@ static int aux_output_begin(struct perf_output_handle *handle,
14261426
idx = aux->empty_mark + 1;
14271427
for (i = 0; i < range_scan; i++, idx++) {
14281428
te = aux_sdb_trailer(aux, idx);
1429-
te->flags = te->flags & ~SDB_TE_BUFFER_FULL_MASK;
1430-
te->flags = te->flags & ~SDB_TE_ALERT_REQ_MASK;
1429+
te->flags &= ~(SDB_TE_BUFFER_FULL_MASK |
1430+
SDB_TE_ALERT_REQ_MASK);
14311431
te->overflow = 0;
14321432
}
14331433
/* Save the position of empty SDBs */
@@ -1470,8 +1470,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index,
14701470
te = aux_sdb_trailer(aux, alert_index);
14711471
do {
14721472
orig_flags = te->flags;
1473-
orig_overflow = te->overflow;
1474-
*overflow = orig_overflow;
1473+
*overflow = orig_overflow = te->overflow;
14751474
if (orig_flags & SDB_TE_BUFFER_FULL_MASK) {
14761475
/*
14771476
* SDB is already set by hardware.
@@ -1711,7 +1710,7 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages,
17111710
}
17121711

17131712
/* Allocate aux_buffer struct for the event */
1714-
aux = kmalloc(sizeof(struct aux_buffer), GFP_KERNEL);
1713+
aux = kzalloc(sizeof(struct aux_buffer), GFP_KERNEL);
17151714
if (!aux)
17161715
goto no_aux;
17171716
sfb = &aux->sfb;

0 commit comments

Comments
 (0)