From: Nikolay Borisov <nborisov@suse.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: Remove duplicated check
Date: Wed, 21 Feb 2018 08:30:21 +0200 [thread overview]
Message-ID: <e23b32c5-8b5f-c0ff-c8b9-db383dd775fb@suse.com> (raw)
In-Reply-To: <20180220211114.GC7000@dastard>
On 20.02.2018 23:11, Dave Chinner wrote:
> On Tue, Feb 20, 2018 at 03:53:02PM +0200, Nikolay Borisov wrote:
>> The check performed before the memcpy responsible for copying the rest
>> of the inode is already performed before we call xfs_log_dinode_to_disk.
>> So let's remove the 2nd instance of the check. No functional changes.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>> Reported-by: Jeff Mahoney <jeffm@suse.com>
>> ---
>> fs/xfs/xfs_log_recover.c | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
>> index 00240c9ee72e..88dccfb1de96 100644
>> --- a/fs/xfs/xfs_log_recover.c
>> +++ b/fs/xfs/xfs_log_recover.c
>> @@ -3174,11 +3174,8 @@ xlog_recover_inode_pass2(
>> xfs_log_dinode_to_disk(ldip, dip);
>>
>> /* the rest is in on-disk format */
>> - if (item->ri_buf[1].i_len > isize) {
>> - memcpy((char *)dip + isize,
>> - item->ri_buf[1].i_addr + isize,
>> + memcpy((char *)dip + isize, item->ri_buf[1].i_addr + isize,
>> item->ri_buf[1].i_len - isize);
>> - }
>>
>
> This looks wrong.
>
> The previous check is:
>
> if (unlikely(item->ri_buf[1].i_len > isize)) {
> CORRUPTION_ERROR
> ....
> error = -EFSCORRUPTED;
> goto out_release;
> }
>
> So after this item->ri_buf[1].i_len is always <= isize. IOWs, the
> memcpy() is currently dead code that is never executed, not code we
> want to execute in every inode recovery.
Doh, you are right, will resend.
>
> Cheers,
>
> Dave.
>
prev parent reply other threads:[~2018-02-21 6:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-20 13:53 [PATCH] xfs: Remove duplicated check Nikolay Borisov
2018-02-20 16:39 ` Darrick J. Wong
2018-02-20 21:11 ` Dave Chinner
2018-02-21 6:30 ` Nikolay Borisov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e23b32c5-8b5f-c0ff-c8b9-db383dd775fb@suse.com \
--to=nborisov@suse.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).