From patchwork Tue Nov 10 11:17:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7592061 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D27F09F392 for ; Tue, 10 Nov 2015 19:17:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 010D420584 for ; Tue, 10 Nov 2015 19:17:19 +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 0A2D520459 for ; Tue, 10 Nov 2015 19:17:18 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F36311A202F; Tue, 10 Nov 2015 11:17:17 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ml01.01.org (Postfix) with ESMTP id 13A431A202F for ; Tue, 10 Nov 2015 11:17:16 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 10 Nov 2015 11:17:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,271,1444719600"; d="scan'208";a="597744906" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by FMSMGA003.fm.intel.com with ESMTP; 10 Nov 2015 11:17:00 -0800 Subject: [PATCH 1/3] ndctl: fix return value truncation for ndctl_cmd_ars_get_record_{addr, len} From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 10 Nov 2015 06:17:04 -0500 Message-ID: <20151110111704.15310.17901.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151110111659.15310.88429.stgit@dwillia2-desk3.jf.intel.com> References: <20151110111659.15310.88429.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=-1.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, 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 By inspection noticed that these functions were truncating the command results for these fields from 8-bytes to 4. Cc: Vishal Verma Signed-off-by: Dan Williams Reviewed-by: Vishal Verma --- lib/libndctl.c | 8 ++++---- lib/ndctl/libndctl.h | 4 ++-- lib/test-libndctl.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libndctl.c b/lib/libndctl.c index 6bfc79f95b83..ea3947dd3e33 100644 --- a/lib/libndctl.c +++ b/lib/libndctl.c @@ -1873,8 +1873,8 @@ NDCTL_EXPORT unsigned int ndctl_cmd_ars_num_records(struct ndctl_cmd *ars_stat) return 0; } -NDCTL_EXPORT unsigned int ndctl_cmd_ars_get_record_addr(struct ndctl_cmd *ars_stat, - unsigned int rec_index) +NDCTL_EXPORT unsigned long long ndctl_cmd_ars_get_record_addr( + struct ndctl_cmd *ars_stat, unsigned int rec_index) { struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(ars_stat)); @@ -1890,8 +1890,8 @@ NDCTL_EXPORT unsigned int ndctl_cmd_ars_get_record_addr(struct ndctl_cmd *ars_st return 0; } -NDCTL_EXPORT unsigned int ndctl_cmd_ars_get_record_len(struct ndctl_cmd *ars_stat, - unsigned int rec_index) +NDCTL_EXPORT unsigned long long ndctl_cmd_ars_get_record_len( + struct ndctl_cmd *ars_stat, unsigned int rec_index) { struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(ars_stat)); diff --git a/lib/ndctl/libndctl.h b/lib/ndctl/libndctl.h index 1bef168935b0..31118c646520 100644 --- a/lib/ndctl/libndctl.h +++ b/lib/ndctl/libndctl.h @@ -156,9 +156,9 @@ struct ndctl_cmd *ndctl_bus_cmd_new_ars_status(struct ndctl_cmd *ars_cap); unsigned int ndctl_cmd_ars_cap_get_size(struct ndctl_cmd *ars_cap); unsigned int ndctl_cmd_ars_in_progress(struct ndctl_cmd *ars_status); unsigned int ndctl_cmd_ars_num_records(struct ndctl_cmd *ars_stat); -unsigned int ndctl_cmd_ars_get_record_addr(struct ndctl_cmd *ars_stat, +unsigned long long ndctl_cmd_ars_get_record_addr(struct ndctl_cmd *ars_stat, unsigned int rec_index); -unsigned int ndctl_cmd_ars_get_record_len(struct ndctl_cmd *ars_stat, +unsigned long long ndctl_cmd_ars_get_record_len(struct ndctl_cmd *ars_stat, unsigned int rec_index); struct ndctl_cmd *ndctl_dimm_cmd_new_vendor_specific(struct ndctl_dimm *dimm, unsigned int opcode, size_t input_size, size_t output_size); diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c index b0221335606e..b51af6b42880 100644 --- a/lib/test-libndctl.c +++ b/lib/test-libndctl.c @@ -1351,9 +1351,9 @@ static int check_ars_status(struct ndctl_bus *bus, struct ndctl_dimm *dimm, } while (ndctl_cmd_ars_in_progress(cmd)); for (i = 0; i < ndctl_cmd_ars_num_records(cmd); i++) { - fprintf(stderr, "%s: record[%d].addr: 0x%x\n", __func__, i, + fprintf(stderr, "%s: record[%d].addr: 0x%llx\n", __func__, i, ndctl_cmd_ars_get_record_addr(cmd, i)); - fprintf(stderr, "%s: record[%d].length: 0x%x\n", __func__, i, + fprintf(stderr, "%s: record[%d].length: 0x%llx\n", __func__, i, ndctl_cmd_ars_get_record_len(cmd, i)); }