Received: by 10.223.185.116 with SMTP id b49csp5211893wrg; Tue, 27 Feb 2018 09:31:08 -0800 (PST) X-Google-Smtp-Source: AH8x225u9Ed2IbJVN4LggPo2gB6orlcLX9V9KMHYu18a+ftpfZ+DxjROJIJSzZlv9xuz9N/oCOXl X-Received: by 2002:a17:902:b215:: with SMTP id t21-v6mr15208008plr.414.1519752668106; Tue, 27 Feb 2018 09:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519752668; cv=none; d=google.com; s=arc-20160816; b=woLv6wxujXiEXsODsaCpR9nYtDAEI2lX5bXJSovGpAazjyiF9GSTsaYG9C/+XPE5C4 xEytWCoVKc1rz4zJ9NWEWLv7+yH7e4UVYxgs8FDgBqwTjH7fzvXLjNxDokzq+s1wsOTx Cl+tZAoy5Npy11cWKHHxIcKzCVaSpTe6FVSZ3DEZtWpGBrkJzpRpC/s824CpuiqGRIbe 3F+gsysJW9LWfCjOD3b0CsQ3V/pEPWML++2znlCKjuehTYzWbwEGrkFkTR2nYaM6eMA1 4VrHQaya3D8TuAo32dXZP2Q+spGu1kG+z5/K7kMPLIQ/s5E/g7wds58oZaiTgUk8RngB 81PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=I/JSHh0pNSwY3CtU2moN1ZCM5Je8EIWT1aUo7dTWKdQ=; b=KNQiso7H197m6GgM5DomgrAUavL7DQjfGPkGt6p/gfF1rcbwDS6kcymOmTyixhR4F2 tjmy4GZxvqMk5Ka8ZNcQqs44A5gjD9rzI3TeaBzokIeLHl1zOtyBhEh/vflpvKf71BNp 5SBt3g7K/lE/BpUhz/kZxK9d8ZrYtCOtfylmfvkXOqQLLsv0DR4AkSMBJRwXYt5r+Vok rsHaypBJrDG3qQECDc7PxqzqG5kpej7Kg4rHzn1cjByPbk4eAPOIzUQsJO0IoNnPVdXv 1PjqZeC8ar8xBifabeMHF5olVcFL0+k15wV4RDmgFq0LRvwp5MAY7WS72u6hRhuABP7Q 7H3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65-v6si4140407pla.409.2018.02.27.09.30.52; Tue, 27 Feb 2018 09:31:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751786AbeB0RaH (ORCPT + 99 others); Tue, 27 Feb 2018 12:30:07 -0500 Received: from mga03.intel.com ([134.134.136.65]:38451 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbeB0RaF (ORCPT ); Tue, 27 Feb 2018 12:30:05 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2018 09:30:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,401,1515484800"; d="scan'208";a="23638780" Received: from theros.lm.intel.com ([10.232.112.164]) by fmsmga002.fm.intel.com with ESMTP; 27 Feb 2018 09:30:03 -0800 From: Ross Zwisler To: Dan Williams , linux-nvdimm@lists.01.org, Dave Jiang , Vishal L Verma , linux-kernel@vger.kernel.org Cc: Ross Zwisler Subject: [PATCH 3/3] nfit_test: prevent parsing error of nfit_test.0 Date: Tue, 27 Feb 2018 10:29:52 -0700 Message-Id: <20180227172952.22177-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180227172952.22177-1-ross.zwisler@linux.intel.com> References: <20180227172952.22177-1-ross.zwisler@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When you load nfit_test you currently see the following error in dmesg: nfit_test nfit_test.0: found a zero length table '0' parsing nfit This happens because when we parse the nfit_test.0 table via acpi_nfit_init(), we specify a size of nfit_test->nfit_size. For the first pass through nfit_test.0 where (t->setup_hotplug == 0) this is the size of the entire buffer we allocated, including space for the hot plug structures, not the size that we've actually filled in. Fix this by only trying to parse the size of the structures that we've filled in. Signed-off-by: Ross Zwisler --- tools/testing/nvdimm/test/nfit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index fcd233342273..d785235ba04e 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c @@ -154,6 +154,7 @@ struct nfit_test { void *nfit_buf; dma_addr_t nfit_dma; size_t nfit_size; + size_t nfit_filled; int dcr_idx; int num_dcr; int num_pm; @@ -2053,6 +2054,8 @@ static void nfit_test0_setup(struct nfit_test *t) WARN_ON(offset != t->nfit_size); } + t->nfit_filled = offset; + post_ars_status(&t->ars_state, &t->badrange, t->spa_set_dma[0], SPA0_SIZE); @@ -2172,6 +2175,8 @@ static void nfit_test1_setup(struct nfit_test *t) /* sanity check to make sure we've filled the buffer */ WARN_ON(offset != t->nfit_size); + t->nfit_filled = offset; + post_ars_status(&t->ars_state, &t->badrange, t->spa_set_dma[0], SPA2_SIZE); @@ -2529,7 +2534,7 @@ static int nfit_test_probe(struct platform_device *pdev) nd_desc->ndctl = nfit_test_ctl; rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_buf, - nfit_test->nfit_size); + nfit_test->nfit_filled); if (rc) return rc; -- 2.14.3