Author: avg
Date: Mon May 31 09:10:39 2010
New Revision: 208672
URL: http://svn.freebsd.org/changeset/base/208672

Log:
  g_label: fix possible NULL pointer dereference
  
  in case glabel debug level is >= 1 and gp->provider list is empty
  for some reason
  
  Found by:     clang static analyzer
  MFC after:    4 days

Modified:
  head/sys/geom/label/g_label.c

Modified: head/sys/geom/label/g_label.c
==============================================================================
--- head/sys/geom/label/g_label.c       Mon May 31 09:08:44 2010        
(r208671)
+++ head/sys/geom/label/g_label.c       Mon May 31 09:10:39 2010        
(r208672)
@@ -203,10 +203,8 @@ g_label_destroy(struct g_geom *gp, boole
                            pp->acr, pp->acw, pp->ace);
                        return (EBUSY);
                }
-       } else {
-               G_LABEL_DEBUG(1, "Label %s removed.",
-                   LIST_FIRST(&gp->provider)->name);
-       }
+       } else if (pp != NULL)
+               G_LABEL_DEBUG(1, "Label %s removed.", pp->name);
        g_slice_spoiled(LIST_FIRST(&gp->consumer));
        return (0);
 }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to