diff options
author | Jose Alonso <joalonsof@gmail.com> | 2014-01-26 05:54:18 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-01-29 03:07:50 -0500 |
commit | dbb0dd021dc282fe65c4f66c86821419850c43cc (patch) | |
tree | edec0ead192954a9bc632f56c0fe4c7f619223b8 /drivers/s390/cio | |
parent | 0e47c969c65e213421450c31043353ebe3c67e0c (diff) |
s390/qdio: for_each macro correctness
I observed that there are for_each macros that do an extra memory access
beyond the defined area.
Normally this does not cause problems.
But, this can cause exceptions. For example: if the area is allocated at
the end of a page and the next page is not accessible.
For correctness, I suggest changing the arguments of the 'for loop' like
others 'for_each' do in the kernel.
Signed-off-by: Jose Alonso <joalonsof@gmail.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r-- | drivers/s390/cio/qdio.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index 8acaae18bd11..a563e4c00590 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h | |||
@@ -359,14 +359,12 @@ static inline int multicast_outbound(struct qdio_q *q) | |||
359 | #define need_siga_sync_out_after_pci(q) \ | 359 | #define need_siga_sync_out_after_pci(q) \ |
360 | (unlikely(q->irq_ptr->siga_flag.sync_out_after_pci)) | 360 | (unlikely(q->irq_ptr->siga_flag.sync_out_after_pci)) |
361 | 361 | ||
362 | #define for_each_input_queue(irq_ptr, q, i) \ | 362 | #define for_each_input_queue(irq_ptr, q, i) \ |
363 | for (i = 0, q = irq_ptr->input_qs[0]; \ | 363 | for (i = 0; i < irq_ptr->nr_input_qs && \ |
364 | i < irq_ptr->nr_input_qs; \ | 364 | ({ q = irq_ptr->input_qs[i]; 1; }); i++) |
365 | q = irq_ptr->input_qs[++i]) | 365 | #define for_each_output_queue(irq_ptr, q, i) \ |
366 | #define for_each_output_queue(irq_ptr, q, i) \ | 366 | for (i = 0; i < irq_ptr->nr_output_qs && \ |
367 | for (i = 0, q = irq_ptr->output_qs[0]; \ | 367 | ({ q = irq_ptr->output_qs[i]; 1; }); i++) |
368 | i < irq_ptr->nr_output_qs; \ | ||
369 | q = irq_ptr->output_qs[++i]) | ||
370 | 368 | ||
371 | #define prev_buf(bufnr) \ | 369 | #define prev_buf(bufnr) \ |
372 | ((bufnr + QDIO_MAX_BUFFERS_MASK) & QDIO_MAX_BUFFERS_MASK) | 370 | ((bufnr + QDIO_MAX_BUFFERS_MASK) & QDIO_MAX_BUFFERS_MASK) |