From: Michal Privoznik Date: Thu, 3 Jun 2021 12:19:22 +0000 (+0200) Subject: security_dac: Don't check for !priv in virSecurityDACSetOwnershipInternal() X-Git-Tag: v7.5.0-rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ac78b95d3f539f5121790a04761593c2711233c;p=thirdparty%2Flibvirt.git security_dac: Don't check for !priv in virSecurityDACSetOwnershipInternal() The virSecurityDACSetOwnershipInternal() has two callers and in both the private data (@priv) is obtained via virSecurityManagerGetPrivateData(). But in case of DAC driver the private data can never be NULL. This is because the private data is allocated in virSecurityManagerNewDriver() according to .privateDataLen attribute of secdriver. In case of DAC driver the attribute is set to sizeof(virSecurityDACData). NB, no other function within DAC driver checks for !priv. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 6b8ff5cdef..b6323a7df1 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -677,7 +677,7 @@ virSecurityDACSetOwnershipInternal(const virSecurityDACData *priv, /* Be aware that this function might run in a separate process. * Therefore, any driver state changes would be thrown away. */ - if (priv && src && priv->chownCallback) { + if (src && priv->chownCallback) { rc = priv->chownCallback(src, uid, gid); /* here path is used only for error messages */ path = NULLSTR(src->path);