mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Maxin B. John" <maxin.john@gmail.com>
To: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Cc: gregkh@linuxfoundation.org, andreas.dilger@intel.com,
	josh@joshtriplett.org, bergwolf@gmail.com,
	dulshani.gunawardhana89@gmail.com, jinshan.xiong@intel.com,
	alexey.zhuravlev@intel.com, "Maxin B. John" <maxin.john@enea.com>
Subject: [PATCH 2/2] lustre/lov_obd: fix possible null pointer dereference
Date: Wed,  5 Mar 2014 14:04:36 +0100	[thread overview]
Message-ID: <1394024676-35160-2-git-send-email-maxin.john@enea.com> (raw)
In-Reply-To: <1394024676-35160-1-git-send-email-maxin.john@enea.com>

From: "Maxin B. John" <maxin.john@enea.com>

osc_obd can be NULL. cppcheck reported this:
[lustre/lustre/lov/lov_obd.c:283]: (error) Possible null pointer dereference:
osc_obd - otherwise it is redundant to check if osc_obd is null at line 295

Signed-off-by: Maxin B. John <maxin.john@enea.com>
---
 drivers/staging/lustre/lustre/lov/lov_obd.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 50a77c5..5c0271c 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -279,8 +279,6 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
 	int rc;
 
 	osc_obd = class_exp2obd(tgt->ltd_exp);
-	CDEBUG(D_CONFIG, "%s: disconnecting target %s\n",
-	       obd->obd_name, osc_obd->obd_name);
 
 	if (tgt->ltd_active) {
 		tgt->ltd_active = 0;
@@ -289,14 +287,17 @@ static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
 	}
 
 	lov_proc_dir = obd->obd_proc_private;
-	if (lov_proc_dir)
-		lprocfs_remove_proc_entry(osc_obd->obd_name, lov_proc_dir);
 
 	if (osc_obd) {
 		/* Pass it on to our clients.
 		 * XXX This should be an argument to disconnect,
 		 * XXX not a back-door flag on the OBD.  Ah well.
 		 */
+		CDEBUG(D_CONFIG, "%s: disconnecting target %s\n",
+			obd->obd_name, osc_obd->obd_name);
+		if (lov_proc_dir)
+			lprocfs_remove_proc_entry(osc_obd->obd_name,
+							lov_proc_dir);
 		osc_obd->obd_force = obd->obd_force;
 		osc_obd->obd_fail = obd->obd_fail;
 		osc_obd->obd_no_recov = obd->obd_no_recov;
-- 
1.7.10.4


  reply	other threads:[~2014-03-05 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 13:04 [PATCH 1/2] lustre/mdc_lib: " Maxin B. John
2014-03-05 13:04 ` Maxin B. John [this message]
2014-03-06 19:53   ` [PATCH 2/2] lustre/lov_obd: " Greg KH
2014-03-05 18:53 ` [PATCH 1/2] lustre/mdc_lib: " Dan Carpenter
2014-03-06 19:51   ` Greg KH
2014-03-06 21:41     ` Maxin B. John

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=1394024676-35160-2-git-send-email-maxin.john@enea.com \
    --to=maxin.john@gmail.com \
    --cc=alexey.zhuravlev@intel.com \
    --cc=andreas.dilger@intel.com \
    --cc=bergwolf@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dulshani.gunawardhana89@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jinshan.xiong@intel.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxin.john@enea.com \
    /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

all inboxes | Powered by JetHome®