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: 9857633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE00E60392 for ; Fri, 21 Jul 2017 20:16:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A87332864A for ; Fri, 21 Jul 2017 20:16:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C41328655; Fri, 21 Jul 2017 20:16:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06570285C6 for ; Fri, 21 Jul 2017 20:16:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752811AbdGUUQE (ORCPT ); Fri, 21 Jul 2017 16:16:04 -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-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);