Skip to content

Commit

Permalink
[S390] qdio: Sanitize do_QDIO sanity checks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan Glauber authored and Martin Schwidefsky committed Jun 22, 2009
1 parent f0a0b15 commit 6618241
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arch/s390/include/asm/qdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ extern int qdio_establish(struct qdio_initialize *);
extern int qdio_activate(struct ccw_device *);

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_shutdown(struct ccw_device*, int);
extern int qdio_free(struct ccw_device *);
Expand Down
9 changes: 2 additions & 7 deletions drivers/s390/cio/qdio_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,18 +1497,13 @@ static int handle_outbound(struct qdio_q *q, unsigned int callflags,
* @count: how many buffers to process
*/
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;

if ((bufnr > QDIO_MAX_BUFFERS_PER_Q) ||
(count > QDIO_MAX_BUFFERS_PER_Q) ||
(q_nr >= QDIO_MAX_QUEUES_PER_IRQ))
if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q)
return -EINVAL;

if (!count)
return 0;

irq_ptr = cdev->private->qdio_data;
if (!irq_ptr)
return -ENODEV;
Expand Down

0 comments on commit 6618241

Please sign in to comment.