From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Davis Subject: Re: Possible coding issue in udf?? Date: Sun, 15 May 2011 11:04:27 -0700 (PDT) Message-ID: <177649.65029.qm@web130106.mail.mud.yahoo.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Andreas Schwab Return-path: Received: from nm5-vm0.bullet.mail.bf1.yahoo.com ([98.139.213.150]:37562 "HELO nm5-vm0.bullet.mail.bf1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751249Ab1EOSJs (ORCPT ); Sun, 15 May 2011 14:09:48 -0400 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: I get it now. Thanks. I code, therefore I am --- On Sun, 5/15/11, Andreas Schwab wrote: > From: Andreas Schwab > Subject: Re: Possible coding issue in udf?? > To: "Alex Davis" > Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org > Date: Sunday, May 15, 2011, 1:13 PM > Alex Davis > writes: > > > In fs/udf/inode.c, line 1455, linux 2.6.35, there is > the following code: > > > > udfperms = ((inode->i_mode & > S_IRWXO)) | > > > ((inode->i_mode & S_IRWXG) << > 2) | > > > ((inode->i_mode & S_IRWXU) << > 4); > > > > Shouldn't we be shifting by 3 bits? i.e: > > udfperms = ((inode->i_mode & > S_IRWXO)) | > > > ((inode->i_mode & S_IRWXG) << > 3) | > > > ((inode->i_mode & S_IRWXU) << > 6); > > udfperms contains three bit fields of 5 bits each, of which > 3 bits are > each filled from one of the three RWX parts of i_mode, and > 2 bits > (DELETE and CHATTR) are added later. Thus each of the > three bit fields > are expanded from 3 to 5 bits, so that the second one needs > to be > shifted by 2 and the third one by 4. > > Andreas. > > -- > Andreas Schwab, schwab@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 > 44D5 214B 8276 4ED5 > "And now for something completely different." >