Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6130481iog; Thu, 23 Jun 2022 12:00:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sUCw3iBmBGHVT9W+9tohFpQtCCzxsAP+guocVmjm5Tla7pRymxukoS004z3JRKkmRPENOe X-Received: by 2002:a17:906:3f94:b0:722:fb52:5a24 with SMTP id b20-20020a1709063f9400b00722fb525a24mr7147818ejj.604.1656010822089; Thu, 23 Jun 2022 12:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656010822; cv=none; d=google.com; s=arc-20160816; b=Z/7thqf4DNtK5w83vgCmOoxQc7LwIQAskSOVig1RrdMDKzsIEW5FOO6Z94NThN8CL6 6AwmRPSSviMWmLwmmEsbZkjPWuRBdYonwGZcUGFfKLZLWIhTXIzXRVu/KpDf8mZBcWI+ BG4XizckhR5RRaj1rZ10G+fKmjZBhtzmKhakx7su3O+KM90tWsayEXecoPowkG9Uunbj D+ggF42vtfxcq+Dyt7PgU8J5J2mj5XHmN6yhidUySaFRCKGQp+kGCXlyXc+YGsN82s4C Zeode4DY0HzlGDknMnBB0O9q4SEq6sXBpvY0t4fNauxiJmRV3K5EocJCVg1umReZmCVr skGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mh7DXY5+t4Mp3WkBqxFcw9f/aAr5hC4UiI275qWID68=; b=A6nfg0XTqOzPfQI/g5eBM8IeGXIu42RewX1Re2yJ1vA6h5mmBU5SG4x3y8wtCp9UJ3 XOcAjtPa6bayZaA0hCW4flUvpWKcwe92E/ahGPhT3lS2rZ7qMJqa2DEXqndD1bQtbDn9 TTfjOvIQqvhGompoJroSH3bRy3sn6LrlN48XE++jpDK51PpQirbmtg2TT+udbJHThH8U JYrMn+G69M9mcYMaP2VUvRbGdYd+hlzhkH3lnkC5MuthCfLfiH/fatqe/LKJQJ0Yb2Gn Vz26Bx9zGeC02v1BMO0/yRVfo5n2356MfO0bjLJ7uNO4pQv3h1CoghsfVQgAHAl/sUFK PvmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bJf3tBJ; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv13-20020a17090760cd00b0071bbadaaf42si7501762ejc.425.2022.06.23.11.59.56; Thu, 23 Jun 2022 12:00:22 -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=@linuxfoundation.org header.s=korg header.b=1bJf3tBJ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237015AbiFWST5 (ORCPT + 99 others); Thu, 23 Jun 2022 14:19:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236847AbiFWSQt (ORCPT ); Thu, 23 Jun 2022 14:16:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA5C3336B; Thu, 23 Jun 2022 10:23:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B885B82497; Thu, 23 Jun 2022 17:23:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8631DC3411B; Thu, 23 Jun 2022 17:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005001; bh=0kjdka5G0H4l0mJy+OBKbQFNtN0SuDcvFw/a47atAoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bJf3tBJtifrpuXOEo8TTMV7CeyP4TQQ/6cu/NWSxeNqZ9e3ddNqgTOWs5uyavmDg xK1LW3OdDBqYoCSbjoz4TyTFZQ6L4UVTT8tO0WzPApPni8dwuZotfLLWO223JtM1sY /xxNIk6ut03wOwmSTBPX9VNJvxCObcrN+5z9T6hM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Murilo Opsfelder Araujo , "Michael S. Tsirkin" , Christophe de Dinechin , Sudip Mukherjee Subject: [PATCH 4.19 220/234] virtio-pci: Remove wrong address verification in vp_del_vqs() Date: Thu, 23 Jun 2022 18:44:47 +0200 Message-Id: <20220623164349.276023241@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Murilo Opsfelder Araujo commit 7e415282b41bf0d15c6e0fe268f822d9b083f2f7 upstream. GCC 12 enhanced -Waddress when comparing array address to null [0], which warns: drivers/virtio/virtio_pci_common.c: In function ‘vp_del_vqs’: drivers/virtio/virtio_pci_common.c:257:29: warning: the comparison will always evaluate as ‘true’ for the pointer operand in ‘vp_dev->msix_affinity_masks + (sizetype)((long unsigned int)i * 256)’ must not be NULL [-Waddress] 257 | if (vp_dev->msix_affinity_masks[i]) | ^~~~~~ In fact, the verification is comparing the result of a pointer arithmetic, the address "msix_affinity_masks + i", which will always evaluate to true. Under the hood, free_cpumask_var() calls kfree(), which is safe to pass NULL, not requiring non-null verification. So remove the verification to make compiler happy (happy compiler, happy life). [0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102103 Signed-off-by: Murilo Opsfelder Araujo Message-Id: <20220415023002.49805-1-muriloo@linux.ibm.com> Signed-off-by: Michael S. Tsirkin Acked-by: Christophe de Dinechin Cc: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/virtio/virtio_pci_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -257,8 +257,7 @@ void vp_del_vqs(struct virtio_device *vd if (vp_dev->msix_affinity_masks) { for (i = 0; i < vp_dev->msix_vectors; i++) - if (vp_dev->msix_affinity_masks[i]) - free_cpumask_var(vp_dev->msix_affinity_masks[i]); + free_cpumask_var(vp_dev->msix_affinity_masks[i]); } if (vp_dev->msix_enabled) {