mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jayachandran C." <jchandra@digeo.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] as: Fix issue reported by coverity in drivers/block/as-iosched.c
Date: Thu, 27 Oct 2005 15:45:26 -0700	[thread overview]
Message-ID: <20051027224526.GD20378@random.pao.digeo.com> (raw)

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)

                 reply	other threads:[~2005-10-27 22:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051027224526.GD20378@random.pao.digeo.com \
    --to=jchandra@digeo.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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