Commit 30e8eb86 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/qdio: sanitize put_indicator

qdio maintains an array of struct indicator_t. put_indicator takes a pointer
to a member of a struct indicator_t within that array, calculates the index,
and uses the array and the index to get the struct indicator_t.

Simply use the pointer directly.

Although the pointer happens to point to the first member of that struct
use the container_of macro.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 648a6f44
...@@ -66,13 +66,11 @@ static u32 *get_indicator(void) ...@@ -66,13 +66,11 @@ static u32 *get_indicator(void)
static void put_indicator(u32 *addr) static void put_indicator(u32 *addr)
{ {
int i; struct indicator_t *ind = container_of(addr, struct indicator_t, ind);
if (!addr) if (!addr)
return; return;
i = ((unsigned long)addr - (unsigned long)q_indicators) / atomic_dec(&ind->count);
sizeof(struct indicator_t);
atomic_dec(&q_indicators[i].count);
} }
void tiqdio_add_input_queues(struct qdio_irq *irq_ptr) void tiqdio_add_input_queues(struct qdio_irq *irq_ptr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment