Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1318653iob; Fri, 29 Apr 2022 02:47:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Ni/CW3rmAM/2W2EIfTw4P0QI8SaYI5XX/qD2fdbpVHkKbNwCYAoBuBwaK3YtQfwbJGPD X-Received: by 2002:a05:651c:b1f:b0:24f:3d60:67e4 with SMTP id b31-20020a05651c0b1f00b0024f3d6067e4mr2019218ljr.190.1651225638015; Fri, 29 Apr 2022 02:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651225638; cv=none; d=google.com; s=arc-20160816; b=Ao2onZVFygMeDIWdiXhpQiA0EOm9GM5QcgPR1UfGC5z3q5kN1L7ujwXCxd4dOIfvPu XbAzO9QsNvSGzhPpH3DGWlve68DPf2gBsOekZ2eez1yGxNzRUHseKM2YqQggFSDgfIts NMettCQFPZhrMXX5w7swEhHKdzUZvKBgS0nISkcqCBJK3pkFM2afwXpL0XCQY2ZwFoJu KVF1klUIZKftZgtEcyOrShZidP6HawNkM1T1BLkodDtMp90BPMXq1E/InvzhNqe8whNo xCEPl7f99O68efwFnmZemplgsXoBP/ZK4cI/l+ZJ3QxaNZ4tTQmlcsaQY7vFZJo4EuUg SqGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=Qatp2Yg/wXTDFXvXeilZVsHVfa7JvQVmG1q95f+gwzc=; b=Uu5kEZuNBm+k04s6d6DapfEu+6gXaX+grk1OpUlsPY2cMdrTiW+0IqrPn+5dXuDmTe wT5aWkcmATv1yD8KQ/xBrVCmN97PsG5suVRRrbP4RlD0qQGtgT2xBpSVVIpHZSCK66WC RGU/p6f5BqeHsR6uOMlZbQAPfKkOYCBIrF9Fju8K0Mo6l61Fhv6bODKtRdSomLaq2bgn BbmzwFL61VXKxcWnrvPikxFxnb/sHgfXJ/Fk12zhcAYrNfSrroVArHV1vpNIfAvPMp7M 4af23DVrHzJWHs7znydM4oFV5rJ42CatEbw5gDV3NjzyXE1GvORspsXjhb2K2HhmcT7I tZZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EBKBJOjl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a05651206cb00b0047239a21201si4484315lff.268.2022.04.29.02.46.50; Fri, 29 Apr 2022 02:47:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EBKBJOjl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232073AbiD1KAw (ORCPT + 99 others); Thu, 28 Apr 2022 06:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbiD1KAK (ORCPT ); Thu, 28 Apr 2022 06:00:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B5F3AB0D37 for ; Thu, 28 Apr 2022 02:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651139291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qatp2Yg/wXTDFXvXeilZVsHVfa7JvQVmG1q95f+gwzc=; b=EBKBJOjlODWC9wOT8UmVq2ZlFxE/ArffuzCZHBTbTp5u27Xj9ZK/Exc7gvBU93YFpZtTwI anT7oVD2BBnUWQbUsxeCYqADoXhsvo1beS8hOwaEcnk9T7iijMtKWYwYmKOIv5OfUyBkjQ rZaXkneKVcTwYY/MR3UJfW+rarNAM00= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-A-0Dn3ERNwyb7WSNgbvFUg-1; Thu, 28 Apr 2022 05:48:05 -0400 X-MC-Unique: A-0Dn3ERNwyb7WSNgbvFUg-1 Received: by mail-wm1-f72.google.com with SMTP id v184-20020a1cacc1000000b00393e492a398so4145385wme.5 for ; Thu, 28 Apr 2022 02:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Qatp2Yg/wXTDFXvXeilZVsHVfa7JvQVmG1q95f+gwzc=; b=M/QHscs9zbRjnGmvNxsUwxKaEte1di8FOOgUiZ+jZEXWdmNzL9KDcDUDM/IzjYDWUU UeXFTdPecuva5+5AK+cFJpGxqoj1a+ofMuPww8RqGg34NQoysV07gWReKRQcRHJozWx7 lAhPoVsdQ6dcZcI1Aqri2qsuJgZUzIdOWoOtP50iPYTup5HUCoy/3VcmQFZBUPazKqqK fO9NnNsnCYnaJe/Wq1H+uUb5oLBR3mtJKlWmB4KhgW+GXdHmsXcj5Hx3tOK/UTvN0LBk yD3cQRlMpq6j/DyEizPzQRQPL4kpqdSEPDz2d5DxHntCPhWctHcCSxyEYG+hVipbBy8M cqWA== X-Gm-Message-State: AOAM530/tPOOEloSEhNaZ6Eqhg1sEjrvMSxFmfRGJto88MHj1MRPB64j ZR55qR/1R72bJGhu9lMGVuT6evyZkHXP8E8KlU54dGUK+g9OVKs/q0RuLo+XxyrwMjePUO6li21 OGLdKYvuguiv6FGv7qwbCuaV5 X-Received: by 2002:a5d:4302:0:b0:206:4b2:8690 with SMTP id h2-20020a5d4302000000b0020604b28690mr25833745wrq.224.1651139284002; Thu, 28 Apr 2022 02:48:04 -0700 (PDT) X-Received: by 2002:a5d:4302:0:b0:206:4b2:8690 with SMTP id h2-20020a5d4302000000b0020604b28690mr25833710wrq.224.1651139283752; Thu, 28 Apr 2022 02:48:03 -0700 (PDT) Received: from smtpclient.apple ([2a01:e0a:834:5aa0:80d7:8022:3692:b311]) by smtp.gmail.com with ESMTPSA id t8-20020adfa2c8000000b0020ad7121495sm11722189wra.23.2022.04.28.02.48.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Apr 2022 02:48:03 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: [PATCH 3/3] virtio-pci: Use cpumask_available to fix compilation error From: Christophe Marie Francois Dupont de Dinechin In-Reply-To: <20220415044657-mutt-send-email-mst@kernel.org> Date: Thu, 28 Apr 2022 11:48:01 +0200 Cc: Christophe de Dinechin , trivial@kernel.org, Ben Segall , Andrew Morton , Steven Rostedt , Ingo Molnar , Mel Gorman , Dietmar Eggemann , Vincent Guittot , Paolo Bonzini , Daniel Bristot de Oliveira , Jason Wang , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Zhen Lei , Juri Lelli , Peter Zijlstra , Murilo Opsfelder Araujo Content-Transfer-Encoding: quoted-printable Message-Id: <3D264F7F-624D-4E9D-A139-F1DB0CC6045C@redhat.com> References: <20220414150855.2407137-1-dinechin@redhat.com> <20220414150855.2407137-4-dinechin@redhat.com> <20220415044657-mutt-send-email-mst@kernel.org> To: "Michael S. Tsirkin" X-Mailer: Apple Mail (2.3696.80.82.1.1) X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 15 Apr 2022, at 10:48, Michael S. Tsirkin wrote: >=20 > On Thu, Apr 14, 2022 at 05:08:55PM +0200, Christophe de Dinechin = wrote: >> With GCC 12 and defconfig, we get the following error: >>=20 >> | CC drivers/virtio/virtio_pci_common.o >> | drivers/virtio/virtio_pci_common.c: In function =E2=80=98vp_del_vqs=E2= =80=99: >> | drivers/virtio/virtio_pci_common.c:257:29: error: the comparison = will >> | always evaluate as =E2=80=98true=E2=80=99 for the pointer operand = in >> | =E2=80=98vp_dev->msix_affinity_masks + (sizetype)((long unsigned = int)i * 8)=E2=80=99 >> | must not be NULL [-Werror=3Daddress] >> | 257 | if (vp_dev->msix_affinity_masks[i]) >> | | ^~~~~~ >>=20 >> This happens in the case where CONFIG_CPUMASK_OFFSTACK is not = defined, >> since we typedef cpumask_var_t as an array. The compiler is = essentially >> complaining that an array pointer cannot be NULL. This is not a very >> important warning, but there is a function called cpumask_available = that >> seems to be defined just for that case, so the fix is easy. >>=20 >> Signed-off-by: Christophe de Dinechin >> Signed-off-by: Christophe de Dinechin >=20 > There was an alternate patch proposed for this by > Murilo Opsfelder Araujo. What do you think about that approach? I responded on the other thread, but let me share the response here: [to muriloo@linux.ibm.com] Apologies for the delay in responding, broken laptop=E2=80=A6 In the case where CONFIG_CPUMASK_OFFSTACK is not defined, we have: typedef struct cpumask cpumask_var_t[1]; So that vp_dev->msix_affinity_masks[i] is statically not null (that=E2=80=99= s the warning) but also a static pointer, so not kfree-safe IMO. >=20 >=20 >> --- >> drivers/virtio/virtio_pci_common.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >>=20 >> diff --git a/drivers/virtio/virtio_pci_common.c = b/drivers/virtio/virtio_pci_common.c >> index d724f676608b..5c44a2f13c93 100644 >> --- a/drivers/virtio/virtio_pci_common.c >> +++ b/drivers/virtio/virtio_pci_common.c >> @@ -254,7 +254,7 @@ void vp_del_vqs(struct virtio_device *vdev) >>=20 >> if (vp_dev->msix_affinity_masks) { >> for (i =3D 0; i < vp_dev->msix_vectors; i++) >> - if (vp_dev->msix_affinity_masks[i]) >> + if = (cpumask_available(vp_dev->msix_affinity_masks[i])) >> = free_cpumask_var(vp_dev->msix_affinity_masks[i]); >> } >>=20 >> --=20 >> 2.35.1 >=20