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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux