From nobody Mon Apr 29 14:25:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574064147; cv=none; d=zoho.com; s=zohoarc; b=AO8l1baNLPS5xXfkUyNaGlTfK5W2QAc3OuzXe9RJrNJKNRY40xUnpbCnrfwHOxMJFtX97X+emTYILd3wXBtl+xd9AusxmITc1VYagdnn0f4A91eU0Y/P8bcpvYCTyh4bX+GTE+rdL6MO9goy34smWo3IedEpgQEstL+EpPO1s+M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574064147; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kzb5lzJa7WiQhyySJTbWR2IJBN4Bu691T0MfwTyLA+M=; b=LfsvZ/KP5q5LF2dX/eg9w7bJS+rqrOd/d+IqmEgGnYPCHbTRvFNa/Z81kKiGZvmuHxBGABtS2BKxQbMPoXN9Zuzg4/o+S/2RMWXmVGkv2kSobIwW/+nueCyKABP9umT3hB1eOvHTx2aguPEdgSrQoadJyOtaWVwOlk+c2357X4Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1574064147529739.6436824831043; Mon, 18 Nov 2019 00:02:27 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-22-4omVNuqxO-GYVAfRCaeixw-1; Mon, 18 Nov 2019 03:02:24 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4857E802689; Mon, 18 Nov 2019 08:02:19 +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 EB45718785; Mon, 18 Nov 2019 08:02: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 D0F544BB65; Mon, 18 Nov 2019 08:02:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAI82CfT009121 for ; Mon, 18 Nov 2019 03:02:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 87192BA40; Mon, 18 Nov 2019 08:02:12 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 119479F72 for ; Mon, 18 Nov 2019 08:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574064146; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kzb5lzJa7WiQhyySJTbWR2IJBN4Bu691T0MfwTyLA+M=; b=KsuubwJfRgntPmXHgmrbolAOLqdwTyt/z4HljkN6MFrS8dxFJNK6rRYi+XsFdmrgrGWxuz d0FJIvJ7yHV3dcWw4fLD+xFz8yBynV9BQQZ+5j+HmBLgGi9iygmJhDpGlpYjMJGJZy5pxT 6gown2oIfS7w+DNRAe1G14dVcTJvG4k= From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 18 Nov 2019 09:02:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] vircgroupv2devices: Fix format string for size_t variable 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: 4omVNuqxO-GYVAfRCaeixw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In virCgroupV2DevicesReallocMap() we are debug printing both arguments passed to the function. However, the @size argument is type of size_t but '%lu' is used to format it. Signed-off-by: Michal Privoznik --- src/util/vircgroupv2devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index 6b4ea3142f..dcf8925b18 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -456,7 +456,7 @@ virCgroupV2DevicesReallocMap(int mapfd, int ret =3D -1; VIR_AUTOCLOSE newmapfd =3D virCgroupV2DevicesCreateMap(size); =20 - VIR_DEBUG("realloc devices map mapfd:%d, size:%lu", mapfd, size); + VIR_DEBUG("realloc devices map mapfd:%d, size:%zu", mapfd, size); =20 if (newmapfd < 0) return -1; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:25:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574064148; cv=none; d=zoho.com; s=zohoarc; b=TKBy4lw68iAWflfi/PDjJeVBWhtJNpdatMyvS9DtP1iF1D9s6iLEF/FFe4+/Bky4qSQDBozw8hzc3fHSYm/bbN6L46SDcVhmxba3WDiRYAAjQs8zuaBf655Bd5Wv14I9nwpQd2euV5ZIF9p7MWNNawSwhpTRmxbzgtsoFfR0cos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574064148; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jkmcs+m+6Ykh2mczM07Q0+q8ui8voJDV2UAomyesSs0=; b=LLtyL0wFKMnAZ5ofLsMgR10nh0XtOtua4T+2wVVmargYKju4TCismzMgGXAUYtw8Cz/qMjlcQ45MvitU2HDDM7BkCKLEoQlpKUyFNmgQ+lYusiWekc8kXME7Pv6ypbLYLubJxs1cAS14QQ0r+yexF8v/gCT04PKQQzbs0+BV7pI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1574064148410633.0165478448449; Mon, 18 Nov 2019 00:02:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-NeLjNP7ePKGO_6ILsziVsA-1; Mon, 18 Nov 2019 03:02:25 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FEE2108BD0E; Mon, 18 Nov 2019 08:02:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 17FCC9F72; Mon, 18 Nov 2019 08:02:19 +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 D07DB18089C8; Mon, 18 Nov 2019 08:02:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAI82DN1009129 for ; Mon, 18 Nov 2019 03:02:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5406E9F72; Mon, 18 Nov 2019 08:02:13 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id D342261075 for ; Mon, 18 Nov 2019 08:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574064147; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jkmcs+m+6Ykh2mczM07Q0+q8ui8voJDV2UAomyesSs0=; b=ZECxTyL2zXTE4SfQwxzRJnFVJm1UKIEsYxWANXp8m1YgGiqgdUykizmc08jR0qB0ObTHWn z0HXWIltz4nFwuWp0VqCAF/u59zFHO8C0eUvLVlAAdhquwqohIUGwGy6II4eQOxtqeFAl5 m1HZalqOrZvno0YrIPGqL2Tu5mpElNc= From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 18 Nov 2019 09:02:06 +0100 Message-Id: <02bf7cc68bfc76242f02d23e73cad36618f3f790.1574064056.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] virbpf: Fix typecast to __aligned_u64 type 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: NeLjNP7ePKGO_6ILsziVsA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In functions implemented here we fill this attr union (type of bpf_attr) and just pass it to syscall(2). Thing is that some of the union members are type of __aligned_u64. This is not regular uint64_t. This one is explicitly aligned to 8 bytes, while uint64_t can be aligned to 4 bytes (on 32 bits). We've used explicit typecast to uint64_t to shut compiler which would otherwise complain of assigning a pointer into an integer. Well, we have uintptr_t just for that. Signed-off-by: Michal Privoznik --- src/util/virbpf.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/util/virbpf.c b/src/util/virbpf.c index 44f13fb485..dec8d0133a 100644 --- a/src/util/virbpf.c +++ b/src/util/virbpf.c @@ -65,10 +65,10 @@ virBPFLoadProg(struct bpf_insn *insns, memset(&attr, 0, sizeof(attr)); =20 attr.prog_type =3D progType; - attr.insn_cnt =3D (uint32_t)insnCnt; - attr.insns =3D (uint64_t)insns; - attr.license =3D (uint64_t)"GPL"; - attr.log_buf =3D (uint64_t)logbuf; + attr.insn_cnt =3D insnCnt; + attr.insns =3D (uintptr_t)insns; + attr.license =3D (uintptr_t)"GPL"; + attr.log_buf =3D (uintptr_t)logbuf; attr.log_size =3D LOG_BUF_SIZE; attr.log_level =3D 1; =20 @@ -130,7 +130,7 @@ virBPFQueryProg(int targetfd, attr.query.target_fd =3D targetfd; attr.query.attach_type =3D attachType; attr.query.prog_cnt =3D maxprogids; - attr.query.prog_ids =3D (uint64_t)progids; + attr.query.prog_ids =3D (uintptr_t)progids; =20 rc =3D syscall(SYS_bpf, BPF_PROG_QUERY, &attr, sizeof(attr)); =20 @@ -166,7 +166,7 @@ virBPFGetProgInfo(int progfd, =20 attr.info.bpf_fd =3D progfd; attr.info.info_len =3D sizeof(struct bpf_prog_info); - attr.info.info =3D (uint64_t)info; + attr.info.info =3D (uintptr_t)info; =20 rc =3D syscall(SYS_bpf, BPF_OBJ_GET_INFO_BY_FD, &attr, sizeof(attr)); if (rc < 0) @@ -180,12 +180,12 @@ virBPFGetProgInfo(int progfd, =20 memset(info, 0, sizeof(struct bpf_prog_info)); info->nr_map_ids =3D maplen; - info->map_ids =3D (uint64_t)retmapIDs; + info->map_ids =3D (uintptr_t)retmapIDs; =20 memset(&attr, 0, sizeof(attr)); attr.info.bpf_fd =3D progfd; attr.info.info_len =3D sizeof(struct bpf_prog_info); - attr.info.info =3D (uint64_t)info; + attr.info.info =3D (uintptr_t)info; =20 rc =3D syscall(SYS_bpf, BPF_OBJ_GET_INFO_BY_FD, &attr, sizeof(attr= )); if (rc < 0) @@ -221,7 +221,7 @@ virBPFGetMapInfo(int mapfd, =20 attr.info.bpf_fd =3D mapfd; attr.info.info_len =3D sizeof(struct bpf_map_info); - attr.info.info =3D (uint64_t)info; + attr.info.info =3D (uintptr_t)info; =20 return syscall(SYS_bpf, BPF_OBJ_GET_INFO_BY_FD, &attr, sizeof(attr)); } @@ -237,8 +237,8 @@ virBPFLookupElem(int mapfd, memset(&attr, 0, sizeof(attr)); =20 attr.map_fd =3D mapfd; - attr.key =3D (uint64_t)key; - attr.value =3D (uint64_t)val; + attr.key =3D (uintptr_t)key; + attr.value =3D (uintptr_t)val; =20 return syscall(SYS_bpf, BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr)); } @@ -254,8 +254,8 @@ virBPFGetNextElem(int mapfd, memset(&attr, 0, sizeof(attr)); =20 attr.map_fd =3D mapfd; - attr.key =3D (uint64_t)key; - attr.next_key =3D (uint64_t)nextKey; + attr.key =3D (uintptr_t)key; + attr.next_key =3D (uintptr_t)nextKey; =20 return syscall(SYS_bpf, BPF_MAP_GET_NEXT_KEY, &attr, sizeof(attr)); } @@ -271,8 +271,8 @@ virBPFUpdateElem(int mapfd, memset(&attr, 0, sizeof(attr)); =20 attr.map_fd =3D mapfd; - attr.key =3D (uint64_t)key; - attr.value =3D (uint64_t)val; + attr.key =3D (uintptr_t)key; + attr.value =3D (uintptr_t)val; =20 return syscall(SYS_bpf, BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr)); } @@ -287,7 +287,7 @@ virBPFDeleteElem(int mapfd, memset(&attr, 0, sizeof(attr)); =20 attr.map_fd =3D mapfd; - attr.key =3D (uint64_t)key; + attr.key =3D (uintptr_t)key; =20 return syscall(SYS_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr)); } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list