Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1887741rwr; Sat, 6 May 2023 00:26:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7M/KXC0lTGtvI/0N/CqwmiJ0V9qVzUYg+QZ7XuhGMI2oLwPL6waWpgzmr1fmsBeFudwfW7 X-Received: by 2002:a05:6a20:442a:b0:ff:68f1:679 with SMTP id ce42-20020a056a20442a00b000ff68f10679mr1986587pzb.52.1683357974700; Sat, 06 May 2023 00:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683357974; cv=none; d=google.com; s=arc-20160816; b=f5yLRY8AO0Hs+IIOC5Hnirml7BwaJJOGo4zPLYdRm+bC8WX2i7u4Vgz5WyMcUekjo9 Qlq1AW3zG4NYVUXHwiI0A/pGBV1Nlc4DBH9uX9jHXnwigrEPaYR2a9On1j2Vbd8DPhnV FPD71+wbsCD34AYOEibXtOZeFnVLle+hIjEigPtLvyj8BantOhpRN8nZ9WJzsg95r0K6 RC99LvyEVcFrNLdvChKha9q91iyu6SGuYPtJ/pb+OuCpmEBzT69pQcKpNtwI1H9LyG8Z yjEXkjV02CkrzITLjm7vAZqqV7YLzUOub0vLCM1G9j07MxlqO6GJ+7ide30NBcuxejg9 Ynzw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hARn2U5Ck8gsaGekp7/R1Pqh66Ft8Q75GW6ULFlZglk=; b=SPRRsPHGVPpMTEa+rlcYs13NOzYsyqSI/71vGc+9FneBddhcG6UG1eaI5UyuSac/z4 DXLqElWXuRiivPpfdOYsrElG2gTiW3KuX9K4Jl4il3J4jBZkZ/voiSamJ7sddNEdFktX M76mOL9WL84WFGKJTTpmljT6Q1vArTO6wbCR1AA5SszRjPauPL5pNWQjkkEdPEOkLYAl nP1/4801mv2rfQWau9FSsE3MEuTniblRvUpJpG+anpVjnGranhtqFWCXr3cxTSTkGjIN RM+KxpGrbe2jSrQyAv8KrhtlkS1M+eANWSke+x53A3esd2L8Gthh9hj1gLA306nz66DP LUUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=jCzkfsS+; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k62-20020a638441000000b0052dcd67347fsi67873pgd.475.2023.05.06.00.25.59; Sat, 06 May 2023 00:26:14 -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=@wanadoo.fr header.s=t20230301 header.b=jCzkfsS+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbjEFHLc (ORCPT + 99 others); Sat, 6 May 2023 03:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbjEFHL3 (ORCPT ); Sat, 6 May 2023 03:11:29 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9908C11577 for ; Sat, 6 May 2023 00:11:28 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id vC4bpnvtnGGqgvC4kpbPX0; Sat, 06 May 2023 09:11:27 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1683357087; bh=hARn2U5Ck8gsaGekp7/R1Pqh66Ft8Q75GW6ULFlZglk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jCzkfsS+JENGKpeRh4/VY6mz+f9xHy5jKatmWS04zuwGUv9WRlBqrvl/zlOZJYp7M zNnKHEUPsQopJd4vvX/Tn9tSHcr4HqzeDvGHRbRL8PpMx/HlhZNryCERxcM3pzfCtb mZxm19jDJyvK9C26UCXEW8nVgKEk+ve1wU4nx6Wgr7ezd6QzZ5NreCKmzrU/adE8qk Q3ylq+2ffYcHYFLTM7N8HGkQEqfFVU5dZJgdXym7MKnf7wgr5dWBj/+Bfh1wYC5ua+ 2d0MmoIyRMD4Z0GleiADFS++dIWnjc3g41YjJvVdv/yCKrrucTLC4ScWjbj4DEqPsR xZrPrPGglryxQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 06 May 2023 09:11:27 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-pci@vger.kernel.org Subject: [PATCH 2/2] x86/PCI: Slightly simplify pirq_convert_irt_table() Date: Sat, 6 May 2023 09:11:10 +0200 Message-Id: <84bf047b01452a72642dbe355b02ef016c985a91.1683356951.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 'size' if computed twice. *ir and *it being the same, the result is the same as well. While at it, also use struct_size() which is less verbose, more robust and more informative. Signed-off-by: Christophe JAILLET --- arch/x86/pci/irq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index e29b487cc069..6bc51f80eec2 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c @@ -140,14 +140,13 @@ static inline struct irq_routing_table *pirq_convert_irt_table(u8 *addr, if (ir->signature != IRT_SIGNATURE || !ir->used || entries < ir->used) return NULL; - size = sizeof(*ir) + ir->used * sizeof(ir->slots[0]); + size = struct_size(ir, slots, ir->used); if (size > limit - addr) return NULL; DBG(KERN_DEBUG "PCI: $IRT Interrupt Routing Table found at 0x%lx\n", __pa(ir)); - size = sizeof(*rt) + ir->used * sizeof(rt->slots[0]); rt = kzalloc(size, GFP_KERNEL); if (!rt) return NULL; -- 2.34.1