From nobody Sun Feb 8 20:23:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524662840335599.6289732745257; Wed, 25 Apr 2018 06:27:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 746EB2CE94F; Wed, 25 Apr 2018 13:27:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 183282010CA1; Wed, 25 Apr 2018 13:27:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 45AD34CAA2; Wed, 25 Apr 2018 13:27:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3PDPD37002205 for ; Wed, 25 Apr 2018 09:25:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 357A0202323A; Wed, 25 Apr 2018 13:25:13 +0000 (UTC) Received: from caroline.localdomain (unknown [10.43.2.67]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCBFA202342F for ; Wed, 25 Apr 2018 13:25:12 +0000 (UTC) Received: from caroline.brq.redhat.com (caroline.usersys.redhat.com [127.0.0.1]) by caroline.localdomain (Postfix) with ESMTP id 8F6B312007C for ; Wed, 25 Apr 2018 15:25:09 +0200 (CEST) From: Martin Kletzander To: libvir-list@redhat.com Date: Wed, 25 Apr 2018 15:24:54 +0200 Message-Id: <447f1681cf0b67abf5e844eabc84c4995c775dfb.1524661163.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 17/30] security/: Remove spaces after casts X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 25 Apr 2018 13:27:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander Reviewed-by: J=EF=BF=BDn Tomko --- src/security/security_apparmor.c | 6 ++--- src/security/security_dac.c | 42 ++++++++++++++++---------------- src/security/security_selinux.c | 14 +++++------ src/security/virt-aa-helper.c | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index 92acc9e27c68..333d098be4fd 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -768,7 +768,7 @@ AppArmorSetInputLabel(virSecurityManagerPtr mgr, if (input =3D=3D NULL) return 0; =20 - switch ((virDomainInputType) input->type) { + switch ((virDomainInputType)input->type) { case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: if (input->source.evdev =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -928,7 +928,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr m= gr, ptr->mgr =3D mgr; ptr->def =3D def; =20 - switch ((virDomainHostdevSubsysType) dev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)dev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: { virUSBDevicePtr usb =3D virUSBDeviceNew(usbsrc->bus, usbsrc->device, vroot); @@ -1047,7 +1047,7 @@ AppArmorSetChardevLabel(virSecurityManagerPtr mgr, if (!secdef) return 0; =20 - switch ((virDomainChrType) dev_source->type) { + switch ((virDomainChrType)dev_source->type) { case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_FILE: case VIR_DOMAIN_CHR_TYPE_UNIX: diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 663c8c9eaf52..8938e2dd89dd 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -224,8 +224,8 @@ virSecurityDACSetUserAndGroup(virSecurityManagerPtr mgr, priv->group =3D group; =20 if (virAsprintf(&priv->baselabel, "+%u:+%u", - (unsigned int) user, - (unsigned int) group) < 0) + (unsigned int)user, + (unsigned int)group) < 0) return -1; =20 return 0; @@ -564,7 +564,7 @@ virSecurityDACSetOwnershipInternal(const virSecurityDAC= Data *priv, return 0; =20 VIR_INFO("Setting DAC user and group on '%s' to '%ld:%ld'", - NULLSTR(src ? src->path : path), (long) uid, (long) gid); + NULLSTR(src ? src->path : path), (long)uid, (long)gid); =20 if (priv && src && priv->chownCallback) { rc =3D priv->chownCallback(src, uid, gid); @@ -604,20 +604,20 @@ virSecurityDACSetOwnershipInternal(const virSecurityD= ACData *priv, if (errno =3D=3D EOPNOTSUPP || errno =3D=3D EINVAL) { VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not " "supported by filesystem", - (long) uid, (long) gid, path); + (long)uid, (long)gid, path); } else if (errno =3D=3D EPERM) { VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not " "permitted", - (long) uid, (long) gid, path); + (long)uid, (long)gid, path); } else if (errno =3D=3D EROFS) { VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not " "possible on readonly filesystem", - (long) uid, (long) gid, path); + (long)uid, (long)gid, path); } else { virReportSystemError(errno, _("unable to set user and group to '%ld:%= ld' " "on '%s'"), - (long) uid, (long) gid, path); + (long)uid, (long)gid, path); return -1; } } @@ -921,7 +921,7 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr, if (cbdata.secdef && !cbdata.secdef->relabel) return 0; =20 - switch ((virDomainHostdevSubsysType) dev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)dev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: { virUSBDevicePtr usb; =20 @@ -1094,7 +1094,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerP= tr mgr, scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) return 0; =20 - switch ((virDomainHostdevSubsysType) dev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)dev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: { virUSBDevicePtr usb; =20 @@ -1223,7 +1223,7 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr m= gr, return -1; } =20 - switch ((virDomainChrType) dev_source->type) { + switch ((virDomainChrType)dev_source->type) { case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_FILE: ret =3D virSecurityDACSetOwnership(priv, NULL, @@ -1299,7 +1299,7 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerP= tr mgr, chardevStdioLogd) return 0; =20 - switch ((virDomainChrType) dev_source->type) { + switch ((virDomainChrType)dev_source->type) { case VIR_DOMAIN_CHR_TYPE_DEV: case VIR_DOMAIN_CHR_TYPE_FILE: ret =3D virSecurityDACRestoreFileLabel(priv, dev_source->data.file= .path); @@ -1465,7 +1465,7 @@ virSecurityDACSetInputLabel(virSecurityManagerPtr mgr, if (seclabel && !seclabel->relabel) return 0; =20 - switch ((virDomainInputType) input->type) { + switch ((virDomainInputType)input->type) { case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL= ) < 0) return -1; @@ -1492,7 +1492,7 @@ virSecurityDACRestoreInputLabel(virSecurityManagerPtr= mgr, virSecurityDACDataPtr priv =3D virSecurityManagerGetPrivateData(mgr); int ret =3D -1; =20 - switch ((virDomainInputType) input->type) { + switch ((virDomainInputType)input->type) { case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: ret =3D virSecurityDACRestoreFileLabel(priv, input->source.evdev); break; @@ -1810,7 +1810,7 @@ virSecurityDACSetProcessLabel(virSecurityManagerPtr m= gr, return -1; =20 VIR_DEBUG("Dropping privileges to %u:%u, %d supplemental groups", - (unsigned int) user, (unsigned int) group, ngroups); + (unsigned int)user, (unsigned int)group, ngroups); =20 if (virSetUIDGID(user, group, groups, ngroups) < 0) return -1; @@ -1835,7 +1835,7 @@ virSecurityDACSetChildProcessLabel(virSecurityManager= Ptr mgr, return -1; =20 VIR_DEBUG("Setting child to drop privileges to %u:%u", - (unsigned int) user, (unsigned int) group); + (unsigned int)user, (unsigned int)group); =20 virCommandSetUID(cmd, user); virCommandSetGID(cmd, group); @@ -1878,7 +1878,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr, return rc; } =20 - switch ((virDomainSeclabelType) seclabel->type) { + switch ((virDomainSeclabelType)seclabel->type) { case VIR_DOMAIN_SECLABEL_STATIC: if (seclabel->label =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1889,8 +1889,8 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr, break; case VIR_DOMAIN_SECLABEL_DYNAMIC: if (virAsprintf(&seclabel->label, "+%u:+%u", - (unsigned int) priv->user, - (unsigned int) priv->group) < 0) + (unsigned int)priv->user, + (unsigned int)priv->group) < 0) return rc; if (seclabel->label =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1945,7 +1945,7 @@ virSecurityDACGetProcessLabelInternal(pid_t pid, =20 VIR_DEBUG("Getting DAC user and group on process '%d'", pid); =20 - if (virAsprintf(&path, "/proc/%d", (int) pid) < 0) + if (virAsprintf(&path, "/proc/%d", (int)pid) < 0) goto cleanup; =20 if (lstat(path, &sb) < 0) { @@ -1956,7 +1956,7 @@ virSecurityDACGetProcessLabelInternal(pid_t pid, } =20 snprintf(seclabel->label, VIR_SECURITY_LABEL_BUFLEN, - "+%u:+%u", (unsigned int) sb.st_uid, (unsigned int) sb.st_gid= ); + "+%u:+%u", (unsigned int)sb.st_uid, (unsigned int)sb.st_gid); ret =3D 0; =20 cleanup: @@ -1985,7 +1985,7 @@ virSecurityDACGetProcessLabelInternal(pid_t pid, } =20 snprintf(seclabel->label, VIR_SECURITY_LABEL_BUFLEN, - "+%u:+%u", (unsigned int) p.ki_uid, (unsigned int) p.ki_group= s[0]); + "+%u:+%u", (unsigned int)p.ki_uid, (unsigned int)p.ki_groups[= 0]); =20 return 0; } diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index c26cdacd9f45..5f74ef739b2f 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1112,7 +1112,7 @@ virSecuritySELinuxGetProcessLabel(virSecurityManagerP= tr mgr ATTRIBUTE_UNUSED, return -1; } =20 - if (strlen((char *) ctx) >=3D VIR_SECURITY_LABEL_BUFLEN) { + if (strlen((char *)ctx) >=3D VIR_SECURITY_LABEL_BUFLEN) { virReportError(VIR_ERR_INTERNAL_ERROR, _("security label exceeds " "maximum length: %d"), @@ -1121,7 +1121,7 @@ virSecuritySELinuxGetProcessLabel(virSecurityManagerP= tr mgr ATTRIBUTE_UNUSED, return -1; } =20 - strcpy(sec->label, (char *) ctx); + strcpy(sec->label, (char *)ctx); freecon(ctx); =20 VIR_DEBUG("label=3D%s", sec->label); @@ -1155,7 +1155,7 @@ virSecuritySELinuxSetFileconHelper(const char *path, = const char *tcon, =20 VIR_INFO("Setting SELinux context on '%s' to '%s'", path, tcon); =20 - if (setfilecon_raw(path, (VIR_SELINUX_CTX_CONST char *) tcon) < 0) { + if (setfilecon_raw(path, (VIR_SELINUX_CTX_CONST char *)tcon) < 0) { int setfilecon_errno =3D errno; =20 if (getfilecon_raw(path, &econ) >=3D 0) { @@ -1336,7 +1336,7 @@ virSecuritySELinuxSetInputLabel(virSecurityManagerPtr= mgr, if (seclabel =3D=3D NULL) return 0; =20 - switch ((virDomainInputType) input->type) { + switch ((virDomainInputType)input->type) { case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: if (virSecuritySELinuxSetFilecon(mgr, input->source.evdev, seclabel->imagelabel) < 0) @@ -1366,7 +1366,7 @@ virSecuritySELinuxRestoreInputLabel(virSecurityManage= rPtr mgr, if (seclabel =3D=3D NULL) return 0; =20 - switch ((virDomainInputType) input->type) { + switch ((virDomainInputType)input->type) { case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: rc =3D virSecuritySELinuxRestoreFileLabel(mgr, input->source.evdev= ); break; @@ -1772,7 +1772,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityMa= nagerPtr mgr, scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) return 0; =20 - switch ((virDomainHostdevSubsysType) dev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)dev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: { virUSBDevicePtr usb; =20 @@ -2014,7 +2014,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecuri= tyManagerPtr mgr, scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) return 0; =20 - switch ((virDomainHostdevSubsysType) dev->source.subsys.type) { + switch ((virDomainHostdevSubsysType)dev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: { virUSBDevicePtr usb; =20 diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index ee5e3b0701d6..d0f9876da56f 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1276,7 +1276,7 @@ vahParseArgv(vahControl * ctl, int argc, char **argv) case 'u': if (strlen(optarg) > PROFILE_NAME_SIZE - 1) vah_error(ctl, 1, _("invalid UUID")); - if (virStrcpy((char *) ctl->uuid, optarg, + if (virStrcpy((char *)ctl->uuid, optarg, PROFILE_NAME_SIZE) =3D=3D NULL) vah_error(ctl, 1, _("error copying UUID")); break; --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list