aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2017-10-26 16:47:25 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2017-11-03 08:00:33 +0100
commit30e8eb867122183076b7994f9b83920f9ec5451b (patch)
treeba3df25bb0a248d9ea9342f6e32737cb2ff61564 /drivers/s390
parents390/qdio: use atomic_cmpxchg (diff)
downloadlinux-dev-30e8eb867122183076b7994f9b83920f9ec5451b.tar.xz
linux-dev-30e8eb867122183076b7994f9b83920f9ec5451b.zip
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: Sebastian Ott <sebott@linux.vnet.ibm.com> Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/cio/qdio_thinint.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index 3e587bf426b0..f99d1c36168d 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -66,13 +66,11 @@ static u32 *get_indicator(void)
static void put_indicator(u32 *addr)
{
- int i;
+ struct indicator_t *ind = container_of(addr, struct indicator_t, ind);
if (!addr)
return;
- i = ((unsigned long)addr - (unsigned long)q_indicators) /
- sizeof(struct indicator_t);
- atomic_dec(&q_indicators[i].count);
+ atomic_dec(&ind->count);
}
void tiqdio_add_input_queues(struct qdio_irq *irq_ptr)