[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1394024676-35160-2-git-send-email-maxin.john@enea.com>
Date: Wed, 5 Mar 2014 14:04:36 +0100
From: "Maxin B. John" <maxin.john@...il.com>
To: linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org
Cc: gregkh@...uxfoundation.org, andreas.dilger@...el.com,
josh@...htriplett.org, bergwolf@...il.com,
dulshani.gunawardhana89@...il.com, jinshan.xiong@...el.com,
alexey.zhuravlev@...el.com, "Maxin B. John" <maxin.john@...a.com>
Subject: [PATCH 2/2] lustre/lov_obd: fix possible null pointer dereference
From: "Maxin B. John" <maxin.john@...a.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@...a.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists