[PATCH] as: Fix issue reported by coverity in drivers/block/as-iosched.c

From: Jayachandran C.
Date: Thu Oct 27 2005 - 17:45:41 EST


This fixes an issue found in drivers/block/as-iosched.c by Coverity.

Error reported:
CID: 3167
Checker: FORWARD_NULL (help)
File: /export2/p4-coverity/mc2/linux26/drivers/block/as-iosched.c
Function: as_insert_request
Description: Variable "arq" tracked as NULL was passed to a function that
dereferences it.

Patch description:
It looks as if the code already assumes that arq != NULL. If arq == NULL, it
should crash later where arq is dereferenced(e.g. as_add_request) without
checking. Removed the NULL check.

Signed-off-by: Jayachandran C. <c.jayachandran at gmail.com>

---

as-iosched.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

--- linux-2.6.14-rc4-git2.clean/drivers/block/as-iosched.c 2005-08-28 16:41:01.000000000 -0700
+++ linux-2.6.14-rc4-git2/drivers/block/as-iosched.c 2005-10-26 15:57:50.342974379 -0700
@@ -1513,13 +1513,11 @@
struct as_data *ad = q->elevator->elevator_data;
struct as_rq *arq = RQ_DATA(rq);

- if (arq) {
- if (arq->state != AS_RQ_PRESCHED) {
- printk("arq->state: %d\n", arq->state);
- WARN_ON(1);
- }
- arq->state = AS_RQ_NEW;
+ if (arq->state != AS_RQ_PRESCHED) {
+ printk("arq->state: %d\n", arq->state);
+ WARN_ON(1);
}
+ arq->state = AS_RQ_NEW;

/* barriers must flush the reorder queue */
if (unlikely(rq->flags & (REQ_SOFTBARRIER | REQ_HARDBARRIER)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/