diff options
author | Jan Glauber <jang@linux.vnet.ibm.com> | 2009-06-22 06:08:15 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-22 06:08:21 -0400 |
commit | 6618241b47cd131503610d8df68dd6f4948e5c1a (patch) | |
tree | 819e61b72ca0538a499779793afdc6e5b950f10c | |
parent | f0a0b15e0f3aff0a25f21f58bef8e40e80b16dc6 (diff) |
[S390] qdio: Sanitize do_QDIO sanity checks
Remove unneeded sanity checks from do_QDIO since this is the hot path.
Change the type of bufnr and count to unsigned int so the check for the
maximum value works.
Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/include/asm/qdio.h | 2 | ||||
-rw-r--r-- | drivers/s390/cio/qdio_main.c | 9 |
2 files changed, 3 insertions, 8 deletions
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h index 402d6dcf0d26..79d849f014f0 100644 --- a/arch/s390/include/asm/qdio.h +++ b/arch/s390/include/asm/qdio.h | |||
@@ -380,7 +380,7 @@ extern int qdio_establish(struct qdio_initialize *); | |||
380 | extern int qdio_activate(struct ccw_device *); | 380 | extern int qdio_activate(struct ccw_device *); |
381 | 381 | ||
382 | extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags, | 382 | extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags, |
383 | int q_nr, int bufnr, int count); | 383 | int q_nr, unsigned int bufnr, unsigned int count); |
384 | extern int qdio_cleanup(struct ccw_device*, int); | 384 | extern int qdio_cleanup(struct ccw_device*, int); |
385 | extern int qdio_shutdown(struct ccw_device*, int); | 385 | extern int qdio_shutdown(struct ccw_device*, int); |
386 | extern int qdio_free(struct ccw_device *); | 386 | extern int qdio_free(struct ccw_device *); |
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index 75b521963a4e..0038750ad945 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c | |||
@@ -1497,18 +1497,13 @@ out: | |||
1497 | * @count: how many buffers to process | 1497 | * @count: how many buffers to process |
1498 | */ | 1498 | */ |
1499 | int do_QDIO(struct ccw_device *cdev, unsigned int callflags, | 1499 | int do_QDIO(struct ccw_device *cdev, unsigned int callflags, |
1500 | int q_nr, int bufnr, int count) | 1500 | int q_nr, unsigned int bufnr, unsigned int count) |
1501 | { | 1501 | { |
1502 | struct qdio_irq *irq_ptr; | 1502 | struct qdio_irq *irq_ptr; |
1503 | 1503 | ||
1504 | if ((bufnr > QDIO_MAX_BUFFERS_PER_Q) || | 1504 | if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q) |
1505 | (count > QDIO_MAX_BUFFERS_PER_Q) || | ||
1506 | (q_nr >= QDIO_MAX_QUEUES_PER_IRQ)) | ||
1507 | return -EINVAL; | 1505 | return -EINVAL; |
1508 | 1506 | ||
1509 | if (!count) | ||
1510 | return 0; | ||
1511 | |||
1512 | irq_ptr = cdev->private->qdio_data; | 1507 | irq_ptr = cdev->private->qdio_data; |
1513 | if (!irq_ptr) | 1508 | if (!irq_ptr) |
1514 | return -ENODEV; | 1509 | return -ENODEV; |