mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] as: Fix issue reported by coverity in drivers/block/as-iosched.c
@ 2005-10-27 22:45 Jayachandran C.
  0 siblings, 0 replies; only message in thread
From: Jayachandran C. @ 2005-10-27 22:45 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-27 22:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-27 22:45 [PATCH] as: Fix issue reported by coverity in drivers/block/as-iosched.c Jayachandran C.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome