Commit 6618241b authored by Jan Glauber's avatar Jan Glauber Committed by Martin Schwidefsky

[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: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarJan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent f0a0b15e
...@@ -380,7 +380,7 @@ extern int qdio_establish(struct qdio_initialize *); ...@@ -380,7 +380,7 @@ extern int qdio_establish(struct qdio_initialize *);
extern int qdio_activate(struct ccw_device *); extern int qdio_activate(struct ccw_device *);
extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags, extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
int q_nr, int bufnr, int count); int q_nr, unsigned int bufnr, unsigned int count);
extern int qdio_cleanup(struct ccw_device*, int); extern int qdio_cleanup(struct ccw_device*, int);
extern int qdio_shutdown(struct ccw_device*, int); extern int qdio_shutdown(struct ccw_device*, int);
extern int qdio_free(struct ccw_device *); extern int qdio_free(struct ccw_device *);
......
...@@ -1497,18 +1497,13 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags, ...@@ -1497,18 +1497,13 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags,
* @count: how many buffers to process * @count: how many buffers to process
*/ */
int do_QDIO(struct ccw_device *cdev, unsigned int callflags, int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
int q_nr, int bufnr, int count) int q_nr, unsigned int bufnr, unsigned int count)
{ {
struct qdio_irq *irq_ptr; struct qdio_irq *irq_ptr;
if ((bufnr > QDIO_MAX_BUFFERS_PER_Q) || if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q)
(count > QDIO_MAX_BUFFERS_PER_Q) ||
(q_nr >= QDIO_MAX_QUEUES_PER_IRQ))
return -EINVAL; return -EINVAL;
if (!count)
return 0;
irq_ptr = cdev->private->qdio_data; irq_ptr = cdev->private->qdio_data;
if (!irq_ptr) if (!irq_ptr)
return -ENODEV; return -ENODEV;
......
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