]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.arch/s390-17-perf-07-qdio_sanitize_do_QDIO_sanity_checks.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / s390-17-perf-07-qdio_sanitize_do_QDIO_sanity_checks.patch
1 From: Gerald Schaefer <geraldsc@de.ibm.com>
2 Subject: [PATCH] qdio: Sanitize do_QDIO sanity checks
3 References: bnc#532063,LTC#55526
4
5 From: Jan Glauber <jang@linux.vnet.ibm.com>
6
7 Remove unneeded sanity checks from do_QDIO since this is the hot path.
8 Change the type of bufnr and count to unsigned int so the check for the
9 maximum value works.
10
11 Reported-by: Roel Kluin <roel.kluin@gmail.com>
12 Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com>
13
14 Acked-by: John Jolly <jjolly@suse.de>
15
16 ---
17 arch/s390/include/asm/qdio.h | 2 +-
18 drivers/s390/cio/qdio_main.c | 9 ++-------
19 2 files changed, 3 insertions(+), 8 deletions(-)
20
21 Index: linux-sles11/arch/s390/include/asm/qdio.h
22 ===================================================================
23 --- linux-sles11.orig/arch/s390/include/asm/qdio.h
24 +++ linux-sles11/arch/s390/include/asm/qdio.h
25 @@ -373,7 +373,7 @@ extern int qdio_establish(struct qdio_in
26 extern int qdio_activate(struct ccw_device *);
27
28 extern int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
29 - int q_nr, int bufnr, int count);
30 + int q_nr, unsigned int bufnr, unsigned int count);
31 extern int qdio_cleanup(struct ccw_device*, int);
32 extern int qdio_shutdown(struct ccw_device*, int);
33 extern int qdio_free(struct ccw_device *);
34 Index: linux-sles11/drivers/s390/cio/qdio_main.c
35 ===================================================================
36 --- linux-sles11.orig/drivers/s390/cio/qdio_main.c
37 +++ linux-sles11/drivers/s390/cio/qdio_main.c
38 @@ -1582,18 +1582,13 @@ out:
39 * @count: how many buffers to process
40 */
41 int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
42 - int q_nr, int bufnr, int count)
43 + int q_nr, unsigned int bufnr, unsigned int count)
44 {
45 struct qdio_irq *irq_ptr;
46
47 - if ((bufnr > QDIO_MAX_BUFFERS_PER_Q) ||
48 - (count > QDIO_MAX_BUFFERS_PER_Q) ||
49 - (q_nr > QDIO_MAX_QUEUES_PER_IRQ))
50 + if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q)
51 return -EINVAL;
52
53 - if (!count)
54 - return 0;
55 -
56 irq_ptr = cdev->private->qdio_data;
57 if (!irq_ptr)
58 return -ENODEV;