Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3554506imm; Mon, 2 Jul 2018 00:56:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJKeYTj79+4z2zOYef95CpPlOqEwgo5p/NxvIPUhphcEOYBghQBoZ+f5I8K86HI1m8aQ2cK X-Received: by 2002:a65:4107:: with SMTP id w7-v6mr20237396pgp.90.1530518205342; Mon, 02 Jul 2018 00:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530518205; cv=none; d=google.com; s=arc-20160816; b=n51aAMLkQ8AQJyEMzBz+eFMgcWqGfKyISxBFbHwqQOLxGt3tWUzxCl/p5GH2dQcQJz ZFfbTaFiwJGwKCCxzHFYXco9gSWVGCTeHoOWoagvzeKBf0+Z5BNWZrQkRQlbeTTFR98l Vw7yeoHj6dkqRxG6/FzqXaKTekz+szwwRh59fnQrowJfnxFanDomx/cPlN3K1SfPF3El dthfvApehLoTI/QIQ0zyUYsh4ywl1J2Y2CtvvoYxsITtN83opKBPeBeguCH7s3qpg3Kf ykRSCZWSdZenwWCrVBartyya4wsnMxcwt/0OjlnnbUvNV9jRU0uzljMjt18aePRX0pOm UJng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Yk6RoF2tc+8rzMV9WMHDbZMfvapVnhCpQdI96VpALyY=; b=VErFgxnSsSGlypHtQwsbn9fI+K28v8/tLHOUuDkAK+nvUjX6yeG8GQRM9NTEO8m43g 2Ii01UGPt/fRUc641rsMsF0/Zp7VJj1S75z6RCsoTwoh7mxEzdmxRvz7Nd8vzbZBBICO N4vsgoAVz2yKk/dL+uN6kQJDbtI7thC++kFCgdsG+PXle5b9b4v5pVMrJ+mbRM1970Kw 1G7aD1SG2yGxbyy/IizsC7eipRl8dmJN4FuxTU8nB/MLyTeYi9Vgb3FXNFqxpuLPr0MG ax7S68epDR4N5TUvcbAyAcnjiH0aiaeUOSorW1dkpSKZwuZYlbOGxGwvEbB7EgG4rx2B /Hmw== 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 m14-v6si542280pfh.92.2018.07.02.00.56.30; Mon, 02 Jul 2018 00:56:45 -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 S1753689AbeGBHzr (ORCPT + 99 others); Mon, 2 Jul 2018 03:55:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:40228 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753169AbeGBHzq (ORCPT ); Mon, 2 Jul 2018 03:55:46 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EED9CAD3A; Mon, 2 Jul 2018 07:55:44 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id A08641E3BDF; Mon, 2 Jul 2018 09:55:43 +0200 (CEST) Date: Mon, 2 Jul 2018 09:55:43 +0200 From: Jan Kara To: Huaisheng Ye Cc: "\"Al Viro\"" , dan.j.williams@intel.com, dave.jiang@intel.com, willy@infradead.org, ross.zwisler@linux.intel.com, vishal.l.verma@intel.com, jack@suse.com, chengnt@lenovo.com, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, "\"Huaisheng Ye\"" Subject: Re: [PATCH 2/3] fs/ext2/inode: Fix a type cast error for fsdax Message-ID: <20180702075543.k7y73aj3s3gp4ptz@quack2.suse.cz> References: <20180701061848.7036-1-yehs2007@zoho.com> <20180701061848.7036-2-yehs2007@zoho.com> <20180701192600.GT30522@ZenIV.linux.org.uk> <16459a9432e.10c419704327.5268154349116077352@zoho.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16459a9432e.10c419704327.5268154349116077352@zoho.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 02-07-18 14:23:42, Huaisheng Ye wrote: > ---- On Mon, 02 Jul 2018 03:26:00 +0800 Al Viro wrote ---- > > On Sun, Jul 01, 2018 at 02:18:47PM +0800, Huaisheng Ye wrote: > > > From: Huaisheng Ye > > > > > > The type of offset within struct iomap is loff_t, which represents > > > file offset of mapping. > > > > > > In ext2_iomap_begin, iomap->offset shall be given a type cast as > > > loff_t instead of u64. > > > > Why is it an error? loff_t is uniformly typedefed to long long. > > In which case the second variant is different from the first one > > *and* does not step into nasal demon territory? > > Sorry for my inaccuracy. > The type of iomap->offset is loff_t, is it better to cast first_block > to loff_t, then do the left shift operation? I think what Al meant is that in the kernel loff_t is 64-bit anyway and furthermore it is signed which means most people have to look up C standard to remember how right shift is (un)defined if it would overflow ;). So this does not really make the code any more readable. Rather on contrary... Honza > > > > > > - iomap->offset = (u64)first_block << blkbits; > > > + iomap->offset = (loff_t)first_block << blkbits; > > > > --- > Cheers, > Huaisheng > > -- Jan Kara SUSE Labs, CR