Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp49697yba; Fri, 19 Apr 2019 20:07:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMKQqRNgAuBu3RzWvtqJh3xZI/aueZMVzBKqlyVWJQZf0N3oZyvh5rE+xYpOuhyp5KamkR X-Received: by 2002:a62:448d:: with SMTP id m13mr7795561pfi.182.1555729647290; Fri, 19 Apr 2019 20:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555729647; cv=none; d=google.com; s=arc-20160816; b=vGu6v3heJYcJUsN3VmVPGhQVm3+YV1DLo9gEn5OeBQyndyhKvTDM8gvB5qt8BAkhHz 32sYx9hH9cjJaJLFGGhNvQ0EzZOrWnA8SVbYBbJb4L2k9W29KBCnoAj4x7KbOq8Ce0SM b0KtbuFHE37s9IR1bguhv6gZwPbYM9H9Dd4oXsl+WdaRagLCjYQ60TnIvIhp5OolgJFv /NRsmba/iiCHxS0JizS/d7gp/aTF57zVAk3MiGVIRXTlB156NSjnhSnUnmqQlt/XJkRA LO7LBAINwKAK3tzqbE/vnFBPv28RNeofOKhf21G+lLyGcCCXPHwsHb45hkuxNyMEdqtf HNiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=AJ1oLZktK2O3NjXlOqIYK8BtAdqPgG4E3cHOvxNOE2w=; b=GJLOuknYRfRt4P5npyxOyi7cIx4ZOdXqy5Pct9iX+PWvdT6rqBRZQZ6tgFfxQsC94d JtLp+3vyFgBrZuSFcKr9pr9EFeZGqgU8HTpL9HqBbm9s6dtlNgvbDGF4xLhq9SwHorvu cim/i7Af+LNPJ22WGYKAzg+OFRycrD0aXjTTxA+229zbvBsHjE/APWDNVmY3DDos1LZv XH1Etdyb/87bPGfTtmrlOhsoSw6sUHKZX2z4Icbf1NPgLnZ7fPpfHx9qTAVi/d6/FWAg DRMbPywbzaSnBM8u3dZhTUOTdvPX5Hrl6jg+e+thVgphOv6tE7vRq6qYv6WP2kjk01SH Hx+A== 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 v12si6323688pga.148.2019.04.19.20.07.12; Fri, 19 Apr 2019 20:07:27 -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 S1726150AbfDTDFJ (ORCPT + 99 others); Fri, 19 Apr 2019 23:05:09 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:2561 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725911AbfDTDFJ (ORCPT ); Fri, 19 Apr 2019 23:05:09 -0400 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.53]) by Forcepoint Email with ESMTP id BC27E47654C311B55469; Sat, 20 Apr 2019 11:05:06 +0800 (CST) Received: from dggeme763-chm.china.huawei.com (10.3.19.109) by DGGEMM404-HUB.china.huawei.com (10.3.20.212) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sat, 20 Apr 2019 11:05:06 +0800 Received: from [10.134.22.195] (10.134.22.195) by dggeme763-chm.china.huawei.com (10.3.19.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Sat, 20 Apr 2019 11:05:06 +0800 Subject: Re: [PATCH] f2fs: Force type conversion from __le32 to u32 To: Bharath Vedartham , CC: , References: <20190418073510.GA11396@bharath12345-Inspiron-5559> From: Chao Yu Message-ID: <00548c37-765a-a2df-9ddf-d53c6ae6bae7@huawei.com> Date: Sat, 20 Apr 2019 11:05:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190418073510.GA11396@bharath12345-Inspiron-5559> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-ClientProxiedBy: dggeme706-chm.china.huawei.com (10.1.199.102) To dggeme763-chm.china.huawei.com (10.3.19.109) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/4/18 15:35, Bharath Vedartham wrote: > This patch forces type conversion from __le32 to u32 to prevent sparse > warnings like: > warning: restricted __le32 degrades to integer > > dir.c: > fscrypt_fname_disk_to_usr takes a hash of type u32 as it's second arg > but de->hash_code is of type __le32. > > node.c > NULL_ADDR is of type u32 but block_addr is of type __le32. > > Signed-off-by: Bharath Vedartham > --- > fs/f2fs/dir.c | 2 +- > fs/f2fs/node.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c > index 59bc460..4f39872 100644 > --- a/fs/f2fs/dir.c > +++ b/fs/f2fs/dir.c > @@ -828,7 +828,7 @@ int f2fs_fill_dentries(struct dir_context *ctx, struct f2fs_dentry_ptr *d, > int save_len = fstr->len; > > err = fscrypt_fname_disk_to_usr(d->inode, > - (u32)de->hash_code, 0, le32_to_cpu(de->hash_code) > + (__force u32)de->hash_code, 0, > &de_name, fstr); > if (err) > goto out; > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c > index 3f99ab2..9e333a5 100644 > --- a/fs/f2fs/node.c > +++ b/fs/f2fs/node.c > @@ -2706,7 +2706,7 @@ static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid, > i = 1; > } > for (; i < NAT_ENTRY_PER_BLOCK; i++) { > - if (nat_blk->entries[i].block_addr != NULL_ADDR) > + if ((__force u32)nat_blk->entries[i].block_addr != NULL_ADDR) block_t blkaddr = le32_to_cpu(nat_blk->entries[i].block_addr); if (blkaddr != NULL_ADDR) Thanks, > valid++; > } > if (valid == 0) { >