From patchwork Sun Nov 22 05:18:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7675371 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 39CF6BF90C for ; Sun, 22 Nov 2015 05:18:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 495AB205E7 for ; Sun, 22 Nov 2015 05:18:55 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37A1B205DB for ; Sun, 22 Nov 2015 05:18:54 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F2AA71A1F3F; Sat, 21 Nov 2015 21:18:53 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id 1A2651A1F3F for ; Sat, 21 Nov 2015 21:18:53 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 21 Nov 2015 21:18:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,331,1444719600"; d="scan'208";a="414475" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by fmsmga004.fm.intel.com with ESMTP; 21 Nov 2015 21:18:52 -0800 Subject: [PATCH] ndctl: fix a pmd test case From: Dan Williams To: linux-nvdimm@lists.01.org Date: Sat, 21 Nov 2015 21:18:24 -0800 Message-ID: <20151122051824.11455.39488.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With the pending kernel fixes the O_DIRECT read test is no longer crashing the kernel. Fix the buffer size and mishandling of the file position. Signed-off-by: Dan Williams --- lib/test-dax-pmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/test-dax-pmd.c b/lib/test-dax-pmd.c index 7ea4e6c7bdb6..0fee7bee8817 100644 --- a/lib/test-dax-pmd.c +++ b/lib/test-dax-pmd.c @@ -106,12 +106,12 @@ static int test_pmd(int fd) break; case 1: /* test O_DIRECT of pre-faulted address */ sprintf(addr, "odirect data"); - if (write(fd2, addr, 4096) != 4096) { + if (pwrite(fd2, addr, 4096, 0) != 4096) { faili(i); rc = -ENXIO; } ((char *) buf)[0] = 0; - read(fd2, buf, sizeof(buf)); + pread(fd2, buf, 4096, 0); if (strcmp(buf, "odirect data") != 0) { faili(i); rc = -ENXIO;