From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Ts'o Subject: Re: [PATCH] e2fsck: Correct ext4 dates generated by old kernels Date: Wed, 25 Nov 2015 04:46:32 -0500 Message-ID: <20151125094632.GA2632@thunk.org> References: <1448400852-90545-1-git-send-email-adilger@dilger.ca> <1448431295.7696.9.camel@novalis.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Andreas Dilger , linux-ext4@vger.kernel.org To: David Turner Return-path: Received: from imap.thunk.org ([74.207.234.97]:50492 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbbKYJqh (ORCPT ); Wed, 25 Nov 2015 04:46:37 -0500 Content-Disposition: inline In-Reply-To: <1448431295.7696.9.camel@novalis.org> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Wed, Nov 25, 2015 at 01:01:35AM -0500, David Turner wrote: > On Tue, 2015-11-24 at 14:34 -0700, Andreas Dilger wrote: > > +static int check_inode_extra_negative_epoch(__u32 xtime, __u32 > > extra) { > > + return (xtime & (1 << 31)) != 0 && > > On a re-read, I think the bitshift is technically undefined behavior > because 1 is signed and 2**31 is not representable as a signed (32-bit) > int. Changing it to 1U should fix it. Instead of doing all of the bitshifts, I was thinking about doing something much simpler: ... if (inode->ctime_hi == 3 && fix_problem(....) inode->ctime_hi = 0; if (inode->mtime_hi == 3 && fix_problem(....) inode->mtime_hi = 0; Hmm? That should work just as well, and is easier to read and understand what's going on, and matches with the test we are using in the kernel. - Ted