From patchwork Thu Oct 15 21:06:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7409941 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 B26389F1D5 for ; Thu, 15 Oct 2015 21:12:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3CD82069F for ; Thu, 15 Oct 2015 21:12:06 +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 11FDC2069D for ; Thu, 15 Oct 2015 21:12:06 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 05C696059D; Thu, 15 Oct 2015 14:12:06 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 1817B6059D for ; Thu, 15 Oct 2015 14:12:05 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 15 Oct 2015 14:12:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,687,1437462000"; d="scan'208";a="665283483" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by orsmga003.jf.intel.com with ESMTP; 15 Oct 2015 14:12:03 -0700 Subject: [PATCH 07/11] ndctl: fix integer promotion in test-dpa-alloc From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 15 Oct 2015 17:06:21 -0400 Message-ID: <20151015210621.22046.75924.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151015210544.22046.31483.stgit@dwillia2-desk3.jf.intel.com> References: <20151015210544.22046.31483.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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 Static analysis worries that "size = SZ_4K * round;", may overflow. It will not in this case, but we can clean up the types to address the report. Signed-off-by: Dan Williams --- lib/test-dpa-alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/test-dpa-alloc.c b/lib/test-dpa-alloc.c index 6fa88cc095ea..2916d587ee35 100644 --- a/lib/test-dpa-alloc.c +++ b/lib/test-dpa-alloc.c @@ -37,7 +37,7 @@ static const char *NFIT_TEST_MODULE = "nfit_test"; static const char *NFIT_PROVIDER0 = "nfit_test.0"; static const char *NFIT_PROVIDER1 = "nfit_test.1"; -#define SZ_4K 0x1000 +#define SZ_4K 0x1000UL #define NUM_NAMESPACES 4 #define DEFAULT_AVAILABLE_SLOTS 1015 @@ -53,7 +53,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) unsigned int available_slots, i; struct ndctl_namespace *ndns; struct ndctl_dimm *dimm; - unsigned long long size; + unsigned long size; struct ndctl_bus *bus; char uuid_str[40]; int round; @@ -142,7 +142,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) ndctl_namespace_disable_invalidate(ndns); rc = ndctl_namespace_set_size(ndns, SZ_4K); if (rc) { - fprintf(stderr, "failed to init %s to size: %d\n", + fprintf(stderr, "failed to init %s to size: %ld\n", ndctl_namespace_get_devname(ndns), SZ_4K); return rc; @@ -169,7 +169,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) size = SZ_4K * round; rc = ndctl_namespace_set_size(ndns, size); if (rc) { - fprintf(stderr, "%s: set_size: %llx failed: %d\n", + fprintf(stderr, "%s: set_size: %lx failed: %d\n", ndctl_namespace_get_devname(ndns), size, rc); return rc; } @@ -267,7 +267,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) i++; if (sz == size) continue; - fprintf(stderr, "%s size: %llx expected %llx\n", + fprintf(stderr, "%s size: %llx expected %lx\n", ndctl_namespace_get_devname(ndns), sz, size); return -ENXIO;