Whamcloud - gitweb
LU-1459 llite: Don't use unitialized variable
authorJeremy Filizetti <jeremy.filizetti@gmail.com>
Tue, 5 Jun 2012 00:14:19 +0000 (20:14 -0400)
committerJohann Lombardi <johann@whamcloud.com>
Tue, 12 Jun 2012 20:10:49 +0000 (16:10 -0400)
Currently lov_connect_obd prints warning messages using
an unitialized stack variable. The message also only
prints a uuid instead of a meaningful target name.

Signed-off-by: Jeremy Filizetti <jeremy.filizetti@gmail.com>
Change-Id: I7549acdd45ab70e3528d2f0c153a27a502b0404a
Reviewed-on: http://review.whamcloud.com/2992
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/lov/lov_obd.c

index 3194f45..ceadeb3 100644 (file)
@@ -267,7 +267,7 @@ static int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
                            struct obd_connect_data *data)
 {
         struct lov_obd *lov = &obd->u.lov;
-        struct obd_uuid tgt_uuid;
+        struct obd_uuid   *tgt_uuid;
         struct obd_device *tgt_obd;
         struct obd_uuid lov_osc_uuid = { "LOV_OSC_UUID" };
         struct lustre_handle conn = {0, };
@@ -281,9 +281,10 @@ static int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
         if (!lov->lov_tgts[index])
                 RETURN(-EINVAL);
 
-        tgt_obd = lov->lov_tgts[index]->ltd_obd;
+        tgt_uuid = &lov->lov_tgts[index]->ltd_uuid;
+        tgt_obd  = lov->lov_tgts[index]->ltd_obd;
         if (!tgt_obd->obd_set_up) {
-                CERROR("Target %s not set up\n", obd_uuid2str(&tgt_uuid));
+                CERROR("Target %s not set up\n", obd_uuid2str(tgt_uuid));
                 RETURN(-EINVAL);
         }
 
@@ -306,13 +307,13 @@ static int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
         if (rc) {
                 CERROR("Target %s register_observer error %d; "
                         "will not be able to reactivate\n",
-                        obd_uuid2str(&tgt_uuid), rc);
+                        obd_uuid2str(tgt_uuid), rc);
                 RETURN(rc);
         }
 
         if (imp->imp_invalid) {
                 CDEBUG(D_CONFIG, "not connecting OSC %s; administratively "
-                       "disabled\n", obd_uuid2str(&tgt_uuid));
+                       "disabled\n", obd_uuid2str(tgt_uuid));
                 RETURN(0);
         }
         if (lov->lov_lock_cancel_cb)
@@ -329,7 +330,7 @@ static int lov_connect_obd(struct obd_device *obd, __u32 index, int activate,
         rc = obd_connect(&conn, tgt_obd, &lov_osc_uuid, data, &lov->lov_tgts[index]->ltd_exp);
         if (rc || !lov->lov_tgts[index]->ltd_exp) {
                 CERROR("Target %s connect error %d\n",
-                       obd_uuid2str(&tgt_uuid), rc);
+                       obd_uuid2str(tgt_uuid), rc);
                 GOTO(out_page_cb, rc);
         }