Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp1540005rdb; Sat, 26 Aug 2023 06:53:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFj/+vqvl8l5V6vyIEx5KEo5sdry7968lLWz/FY3bl8Kizto9z013/iwDvcLwctdjABrYWQ X-Received: by 2002:a05:6a20:1041:b0:14c:e089:94d0 with SMTP id gt1-20020a056a20104100b0014ce08994d0mr1065082pzc.37.1693058026499; Sat, 26 Aug 2023 06:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693058026; cv=none; d=google.com; s=arc-20160816; b=r4on4AFAOVbfsXJwMY5y6yW89XbRwefvJWDJKaw0WJE3WAe/MyZvOamJzG2k8ymjyq X4gEq96ZDqOLiIjR+5of//2sRV3eZSOk34nJo3kvjvnwVYAtNlJrnnVXMsfu3oTAd8aG l1thkwy+hXq6M9SIlmX8NI10VJ7mP65vAd8NBeBUZmYjFE6adeZr3t3id5mi1N5x8A5q wwmbfHld8PsPveTB+VL330qL30xJkSnD6MmU46hT5TiUZeeF0lADZDmrNPiUoTHi8bCT /AyRoAkNzjZkvoAYFkkwI0t+m43lMckbz3frjGuQTB3Iugnf+SeYSpoKgxGM93cYxfg8 VZzg== 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 :message-id:date:subject:cc:to:from; bh=8/OJtw3ghcH+BUbrkSgch1KEX3QcLH+VQ4V07kflt78=; fh=GXX+fv+9/KxNDsyU79Hcm/XSMDFg/BuK5TcR5PwU7vM=; b=zYxvFmpwlveeqfIZOJCxpKo232ddK/m+TR3DquuPqqqJG15hKW0AxVZzvuYCcz+FYx TA93FQMGD9DY9n23KG73sUy71ndSPDnvOd5ElVzyHH3xgyG0uZa1NK/LGG7kDJlypicf sHEvUbdXfg3jHRfb647uCLlSnRQRqE0uCNf+7oKrpWfXoZqWrOi6XlsOIPBTpHp4rPzD POzPcruqixJ3Zcw9pDVodl0IC+RCj3QJivaSMBRKMgTsyiEt4WCkpVasiyt1/y+s+Lvd Dw6RsgKHnOmOwhLZpp71WfvXvSlAmfGKtgggyKlK1U+AGmr6cwP201pcaScMgwNNpKXM z+IA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a656785000000b00565f20a03f3si3749131pgr.774.2023.08.26.06.53.26; Sat, 26 Aug 2023 06:53:46 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231743AbjHZHWN (ORCPT + 99 others); Sat, 26 Aug 2023 03:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbjHZHVm (ORCPT ); Sat, 26 Aug 2023 03:21:42 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 593E52137; Sat, 26 Aug 2023 00:21:34 -0700 (PDT) Received: from dggpeml500003.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RXp7D4R3VztSMt; Sat, 26 Aug 2023 15:17:44 +0800 (CST) Received: from huawei.com (10.175.103.91) by dggpeml500003.china.huawei.com (7.185.36.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Sat, 26 Aug 2023 15:21:31 +0800 From: Yu Liao To: , , , , CC: , , , , , , Subject: [PATCH v2 1/2] ACPI: NFIT: Fix incorrect calculation of idt size Date: Sat, 26 Aug 2023 15:16:53 +0800 Message-ID: <20230826071654.564372-1-liaoyu15@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500003.china.huawei.com (7.185.36.200) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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 acpi_nfit_interleave's field 'line_offset' is switched to flexible array [1], but sizeof_idt() still calculates the size in the form of 1-element array. Therefore, fix incorrect calculation in sizeof_idt(). [1] https://lore.kernel.org/lkml/2652195.BddDVKsqQX@kreacher/ Fixes: 2a5ab99847bd ("ACPICA: struct acpi_nfit_interleave: Replace 1-element array with flexible array") Cc: stable@vger.kernel.org # v6.4+ Signed-off-by: Yu Liao Reviewed-by: Dave Jiang --- v1 -> v2: add Dave's review tag and cc nvdimm@lists.linux.dev --- drivers/acpi/nfit/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 07204d482968..305f590c54a8 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -855,7 +855,7 @@ static size_t sizeof_idt(struct acpi_nfit_interleave *idt) { if (idt->header.length < sizeof(*idt)) return 0; - return sizeof(*idt) + sizeof(u32) * (idt->line_count - 1); + return sizeof(*idt) + sizeof(u32) * idt->line_count; } static bool add_idt(struct acpi_nfit_desc *acpi_desc, -- 2.25.1