public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: johnpol@2ka.mipt.ru
Cc: linux-kernel@vger.kernel.org
Subject: [2.6 patch] w1_remove_master_device(): fix check-after-use
Date: Tue, 14 Aug 2007 23:22:48 +0200	[thread overview]
Message-ID: <20070814212248.GD18945@stusta.de> (raw)

The Coverity checker spotted that we'd have already oops'ed if "dev"
was NULL.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
--- linux-2.6.23-rc1-mm2/drivers/w1/w1_int.c.old	2007-08-08 14:38:50.000000000 +0200
+++ linux-2.6.23-rc1-mm2/drivers/w1/w1_int.c	2007-08-08 14:38:58.000000000 +0200
@@ -171,22 +171,17 @@
 void w1_remove_master_device(struct w1_bus_master *bm)
 {
 	struct w1_master *dev = NULL;
 
 	list_for_each_entry(dev, &w1_masters, w1_master_entry) {
 		if (!dev->initialized)
 			continue;
 
 		if (dev->bus_master->data == bm->data)
 			break;
 	}
 
-	if (!dev) {
-		printk(KERN_ERR "Device doesn't exist.\n");
-		return;
-	}
-
 	__w1_remove_master_device(dev);
 }
 
 EXPORT_SYMBOL(w1_add_master_device);
 EXPORT_SYMBOL(w1_remove_master_device);

             reply	other threads:[~2007-08-14 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-14 21:22 Adrian Bunk [this message]
2007-08-14 22:22 ` [2.6 patch] w1_remove_master_device(): fix check-after-use Evgeniy Polyakov

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=20070814212248.GD18945@stusta.de \
    --to=bunk@kernel.org \
    --cc=johnpol@2ka.mipt.ru \
    --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