From: John Ferlan Date: Wed, 13 Feb 2013 13:11:39 +0000 (-0500) Subject: security: Remove unnecessary checks for mgr == NULL X-Git-Tag: v1.0.3-rc1~96 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=676688b69bb5761b74bd1e5bb491562bd6d3dd26;p=thirdparty%2Flibvirt.git security: Remove unnecessary checks for mgr == NULL Coverity found the DACGenLabel was checking for mgr == NULL after a possible dereference; however, in order to get into the function the virSecurityManagerGenLabel would have already dereferenced sec_managers[i] so the check was unnecessary. Same check is made in SELinuxGenSecurityLabel. --- diff --git a/src/security/security_dac.c b/src/security/security_dac.c index b115bb0157..0b274b7b5a 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -913,12 +913,6 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr, virSecurityLabelDefPtr seclabel; virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); - if (mgr == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("invalid security driver")); - return rc; - } - seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME); if (seclabel == NULL) { return rc; diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index a61e0f0e3a..a042b26845 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -560,12 +560,6 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr, virSecuritySELinuxDataPtr data; const char *baselabel; - if (mgr == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid security driver")); - return rc; - } - seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME); if (seclabel == NULL) { return rc;