Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3547929imu; Mon, 28 Jan 2019 06:49:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN4Fiwnu6+DiIIY2Ziyp3Loh5OYFp/JBiRzHOT2hO8ECiLPRGIag2QzJufyJ9IbMEjN2GtXe X-Received: by 2002:a62:5fc4:: with SMTP id t187mr22422269pfb.66.1548686953161; Mon, 28 Jan 2019 06:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548686953; cv=none; d=google.com; s=arc-20160816; b=vF+F4C27AMFUBKNoKHpX5/a53BCqXTRQ54QLeh8I8Uh3voSEDpk1VaG/uf/sPOctAZ cIhmdhFXqCvSypFEGTj0LOsjH5TDhGj2YbQcubT9hs02DtsdYZAU5cC9v+pz+8ZXSI6D jLs30OYRdwz1dmRG7n1IVd/yU79KtupDtxxiPR2DzxtyZI4xUB6/HKIBnK/kHSAet2I3 nBHjksuGybfnHG5IwkrSZhaohs+1edm7UnLEURAbHnL2G+h0KMDrzf83FYQ36P7QVjRh YES0qpUeozqrQYmS4dPnOzVBAXZkxf2uipI5xj6LLw+yoAstSi22yh/gP0Ux7lSDHQx1 IhXA== 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; bh=no0HEiC4S0zzAEIki5PCTs4Ec2OW1AToLxsISd/fE3Y=; b=eSSr41sdHULbsdYakBLwnRtWD8S6iiNLyC0VZGIokeWzDTtpztTR3mTtw6YQ9qg9is KtxgmU/uGtw0CLH7RMr0M//AvYXhemTI7N7m/wl6vFqq4HbFO3sNEzP0oV2wsTo3fDO4 1vT+2zqfAMgCFgoPyh/xfSyhJqIyGwp1lAf80SvZq2wKnuYpFpcubpwSF7SY/EeoYPII Lwl+do80PMS0XSoIWxQrfKIPQ6hkNE85s02rZuh0EE4CuJPlDuh0Nu1jnC6DQ7I7XieP jPecD6p5D3IAtuCVDMqliiLOBlL3JZUXMCZh6p/fqW3htJTjMuZXUoUDyczsYOkJOOHi h8Hg== 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 r34si33351225pga.242.2019.01.28.06.48.57; Mon, 28 Jan 2019 06:49:13 -0800 (PST) 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 S1726804AbfA1Osv (ORCPT + 99 others); Mon, 28 Jan 2019 09:48:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:57096 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726266AbfA1Osu (ORCPT ); Mon, 28 Jan 2019 09:48:50 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9D61AAE5D; Mon, 28 Jan 2019 14:48:49 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 71D281E3FEF; Mon, 28 Jan 2019 15:48:47 +0100 (CET) Date: Mon, 28 Jan 2019 15:48:47 +0100 From: Jan Kara To: Liu Xiang Cc: jack@suse.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, liuxiang_1999@126.com Subject: Re: [PATCH] ext2: Remove useless reset code Message-ID: <20190128144847.GG27972@quack2.suse.cz> References: <1548424864-4647-1-git-send-email-liu.xiang6@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1548424864-4647-1-git-send-email-liu.xiang6@zte.com.cn> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 25-01-19 22:01:04, Liu Xiang wrote: > If ((char *)de == dir_end) is true, the name_len will not be used > in the subsequent routine. So the reset code can be removed. > > Signed-off-by: Liu Xiang Thanks for the patch. I agree with your analysis but I prefer to keep the code as is - it prevents warnings about uninitialized variable being used for compilers than cannot infer that and also for humans reading the code is easier this way. Honza > --- > fs/ext2/dir.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c > index 3b8114d..5ec497f 100644 > --- a/fs/ext2/dir.c > +++ b/fs/ext2/dir.c > @@ -517,7 +517,6 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode) > while ((char *)de <= kaddr) { > if ((char *)de == dir_end) { > /* We hit i_size */ > - name_len = 0; > rec_len = chunk_size; > de->rec_len = ext2_rec_len_to_disk(chunk_size); > de->inode = 0; > -- > 1.9.1 > > -- Jan Kara SUSE Labs, CR