Whamcloud - gitweb
LU-2217 build: fix 'NULL pointer dereference' errors
[fs/lustre-release.git] / lustre / mgc / mgc_request.c
index c7d39bc..f2e3026 100644 (file)
@@ -360,7 +360,15 @@ static int config_log_add(struct obd_device *obd, char *logname,
         LASSERT(lsi->lsi_lmd);
         if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)) {
                 struct config_llog_data *recover_cld;
-                *strrchr(seclogname, '-') = 0;
+               ptr = strrchr(seclogname, '-');
+               if (ptr != NULL) {
+                       *ptr = 0;
+               }
+               else {
+                       CERROR("sptlrpc log name not correct: %s", seclogname);
+                       config_log_put(cld);
+                       RETURN(-EINVAL);
+               }
                 recover_cld = config_recover_log_add(obd, seclogname, cfg, sb);
                if (IS_ERR(recover_cld))
                        GOTO(out_err3, rc = PTR_ERR(recover_cld));