From patchwork Fri Jul 21 20:15:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 108504 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1227770qge; Fri, 21 Jul 2017 13:16:08 -0700 (PDT) X-Received: by 10.84.253.16 with SMTP id z16mr9099564pll.81.1500668168461; Fri, 21 Jul 2017 13:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500668168; cv=none; d=google.com; s=arc-20160816; b=jWeNQY8u8/teukvJs363bKjjz9kbzsv2GQwdRerXx5J6tNghEdgCxvf9G9e+o4RwQA 4aLZaMrdQlPGe0r5Yoq9q2E7ijGmEBz1CzODhn9cpAtVfusrc7NJ0wIe4upB/4ijK4BQ gI/Fnf+DqLrmHe5aCcuqgucXzMyDkP7rzwouzXnRYcsoz1u/0A4F9jT8uwcxoeeDvPjv AKM8cO/TH3D8FS/EcDM7fxlni0UPZSjtykkJDSSgUzhWkU5826Eo4FZjX690koHCpllL h6csbyKQOhh04aHXjDCVb+hml7Ws4uloQa44XuCRkDPgNvUA8vAuFL/9GCsI9bBrumMo BCjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=E8DWYVx+ZWbUp6KR7NFV30ZP1omrzzu/StTFS+XVDI8=; b=fZzuUJBU9EWYaS6GNlZsrfzsa02rAV2hsBWg008j+AXKNZDGmKVqAp3bF2WGi97oxa iwQOkJGu1iV/by4AbyfgZsgV+tnMjKd9E1NaeS3YLmulIchXUSSDkag7iS7u5i+MgOSm elETF0NKbvpzmVDVDm4ADoCZujjBT9tD6WE8kdFffVR7B9tUa01jzXo7Hxxg3c1nGvFf sXw9/i/86HzXVa4qsEo1FGULDVJ6tkviUC36HD3Or16jUuf6VxClzaBo2hqUBc7t9Hqo V6O++giO/wNRb5yPf+KxK0Uh8ehM/btyC03VlWCLAMJ8v1jjW+LAxCnliyVobstAOYhN hLpg== 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 32si2950435pld.682.2017.07.21.13.16.08; Fri, 21 Jul 2017 13:16:08 -0700 (PDT) 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 S1754639AbdGUUQF (ORCPT + 26 others); Fri, 21 Jul 2017 16:16:05 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:52863 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752780AbdGUUQD (ORCPT ); Fri, 21 Jul 2017 16:16:03 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0M40UE-1dpliO0JIQ-00rbDW; Fri, 21 Jul 2017 22:15:50 +0200 From: Arnd Bergmann To: Trond Myklebust , Anna Schumaker Cc: Arnd Bergmann , Benjamin Coddington , Alexey Dobriyan , Jens Axboe , Andrew Morton , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND] nfs: blocklayout: avoid warnings on 32-bit sector_t Date: Fri, 21 Jul 2017 22:15:18 +0200 Message-Id: <20170721201547.3358107-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:PJlG0nld7FIbuvYAh1stX5Y+FLivxGyWdVefezWLrCZ/eV1ClBF dw0/EEIvYxXOtZOSEbWosxHnEvYRoY7RezedoG7rLrWCSIbi4XRH1GkyqgddmnkvPJHAJoj YGf7gvHMVUrnL42CsNJmUfPWszfpXeI9C+Om3pUDOnECqGMe2jR/sIG77UxiwdkTMf2cu3+ +5f3dTlPTh8BbCIWBR1hQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:esFV2mPOU8w=:ChEJQSdHie9Q2p8fNzcoMU w4OkM/00ILdJ/I9HABQbctnOLYztpeXYs48tj6jE+3IB+Psv7zPbSSbQ2Ck3SOotLutVwYF2K 2R29vdX4KkSH0hq0Ju8LkX2CB4ynUWL8ngW5Oj2ho5p9/GprdoiQBKeQODf4+Bot54/m9OSiR tarziV7vZw5jSdvqlfjSMBlIbVvZcShUf13JMKls4iM6Vvts17TYCbg2c3S0LdNMQy7Ljf93+ 0AEMDdGR1UvtBwlcAAIukMIsX0JBWfwh1n+XtMatvFwUpvV1Hl7sTOe1CdXM+gaurtnzEsO2c r0fDT35O627nFMX4FM6iMHB/yiYAGteGvFJE7GLfhljUn0e9rcjaeC6hOPDCd/mX5EMbGdE1h 2EyaUFgAvEL09F/Q7v+5s58/v/g684TjGbOcuvsfrCwN2Ntq0CRmFIxgnoemzslXAZdTjhIvf 7++wvioqe+Nig0n2VCJ8RaX+MT4em4GkkGgOHpB+aJ3DfgiFB7LI7a0jK0wVrxZS+i5TC/Rfn snkWk8UDzERN2IftglBmtW8rXoYxSAXXpF33heT5YqALgv8yTjhCIGPxFUB87Q8ENiy2xmzB1 bTu0H2gHa4xugcRfxmrZcdrJH00qu6KeqFIB8lKXvLvoQQJGW7bMKJdBD0XNcA5XrtRVZuk1R e7JPjROZZMHq/YHd0t4aLBjdDmOD2jaXNeYQ62aoVqRDLkou2t0IiewAtIabEndjNM91pSLc7 KZ5p+cMdpAgiCsRtxArAHqTUTpqtjXRQwjCTMw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sector_t can be either 32-bit or 64-bit wide, but in the former case, the NFS blocklayout code produces a couple of warnings: blocklayout.c: In function 'bl_read_pagelist': blocklayout.c:225:45: error: large integer implicitly truncated to unsigned type [-Werror=overflow] struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; ^ blocklayout.c:282:16: error: large integer implicitly truncated to unsigned type [-Werror=overflow] map.start = NFS4_MAX_UINT64; ^ blocklayout.c: In function 'bl_write_pagelist': blocklayout.c:368:45: error: large integer implicitly truncated to unsigned type [-Werror=overflow] struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; ^ blocklayout.c: In function 'bl_free_layout_hdr': blocklayout.c:443:37: error: large integer implicitly truncated to unsigned type [-Werror=overflow] err = ext_tree_remove(bl, true, 0, LLONG_MAX); ^ blocklayout.c: In function 'bl_return_range': blocklayout.c:708:9: error: large integer implicitly truncated to unsigned type [-Werror=overflow] end = round_down(NFS4_MAX_UINT64, PAGE_SIZE); In all instances, NFS4_MAX_UINT64 is meant to just refer to the largest representable unsigned integer, and the warning is for the implicit type conversiont to a smaller type. As the conversion is ok, we can use an explict cast to stop the warning. Signed-off-by: Arnd Bergmann Fixes: 5c83746a0cf2 ("pnfs/blocklayout: in-kernel GETDEVICEINFO XDR parsing") --- I sent this on Jan 25 2016 but got no reply while the problem remains in linux-4.6-rc1. Please apply. --- fs/nfs/blocklayout/blocklayout.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.9.0 diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index d8863a804b15..52044865c40b 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c @@ -224,7 +224,7 @@ static enum pnfs_try_status bl_read_pagelist(struct nfs_pgio_header *header) { struct pnfs_block_layout *bl = BLK_LSEG2EXT(header->lseg); - struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; + struct pnfs_block_dev_map map = { .start = (sector_t)NFS4_MAX_UINT64 }; struct bio *bio = NULL; struct pnfs_block_extent be; sector_t isect, extent_length = 0; @@ -281,7 +281,7 @@ bl_read_pagelist(struct nfs_pgio_header *header) zero_user_segment(pages[i], pg_offset, pg_len); /* invalidate map */ - map.start = NFS4_MAX_UINT64; + map.start = (sector_t)NFS4_MAX_UINT64; } else { bio = do_add_page_to_bio(bio, header->page_array.npages - i, @@ -368,7 +368,7 @@ static enum pnfs_try_status bl_write_pagelist(struct nfs_pgio_header *header, int sync) { struct pnfs_block_layout *bl = BLK_LSEG2EXT(header->lseg); - struct pnfs_block_dev_map map = { .start = NFS4_MAX_UINT64 }; + struct pnfs_block_dev_map map = { .start = (sector_t)NFS4_MAX_UINT64 }; struct bio *bio = NULL; struct pnfs_block_extent be; sector_t isect, extent_length = 0; @@ -443,7 +443,7 @@ static void bl_free_layout_hdr(struct pnfs_layout_hdr *lo) dprintk("%s enter\n", __func__); - err = ext_tree_remove(bl, true, 0, LLONG_MAX); + err = ext_tree_remove(bl, true, 0, (sector_t)LLONG_MAX); WARN_ON(err); kfree(bl); @@ -721,7 +721,7 @@ bl_return_range(struct pnfs_layout_hdr *lo, end = offset + (range->length >> SECTOR_SHIFT); } else { - end = round_down(NFS4_MAX_UINT64, PAGE_SIZE); + end = round_down((sector_t)NFS4_MAX_UINT64, PAGE_SIZE); } ext_tree_remove(bl, range->iomode & IOMODE_RW, offset, end);