From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/2] xfs: clean up minor sparse warnings
Date: Thu, 22 Dec 2011 10:59:04 +1100 [thread overview]
Message-ID: <20111221235904.GH23662@dastard> (raw)
In-Reply-To: <20111221161349.GB7001@infradead.org>
On Wed, Dec 21, 2011 at 11:13:50AM -0500, Christoph Hellwig wrote:
> > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> > index d99a905..2f3f56a 100644
> > --- a/fs/xfs/xfs_ioctl.c
> > +++ b/fs/xfs/xfs_ioctl.c
> > @@ -230,24 +230,22 @@ xfs_open_by_handle(
> >
> > /* Put open permission in namei format. */
> > permflag = hreq->oflags;
> > - if ((permflag+1) & O_ACCMODE)
> > - permflag++;
> > if (permflag & O_TRUNC)
> > - permflag |= 2;
> > + permflag |= O_RDWR;
> >
> > if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) &&
> > - (permflag & FMODE_WRITE) && IS_APPEND(inode)) {
> > + (OPEN_FMODE(permflag) & FMODE_WRITE) && IS_APPEND(inode)) {
> > error = -XFS_ERROR(EPERM);
> > goto out_dput;
> > }
> >
> > - if ((permflag & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
> > + if ((OPEN_FMODE(permflag) & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
> > error = -XFS_ERROR(EACCES);
> > goto out_dput;
> > }
> >
> > /* Can't write directories. */
> > - if (S_ISDIR(inode->i_mode) && (permflag & FMODE_WRITE)) {
> > + if (S_ISDIR(inode->i_mode) && (OPEN_FMODE(permflag) & FMODE_WRITE)) {
> > error = -XFS_ERROR(EISDIR);
> > goto out_dput;
> > }
>
> I think this one is complicated enough that is deserves a separate
> patch and a better description.
Ok, I've also just found a problem with it(*) so I'll separate it
and resend when I've fixed it.
Cheers,
Dave.
(*) did you know we actually have a test (079) that verifies this
logic? I didn't until a little while ago....
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-12-21 23:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-21 0:07 [PATCH 0/2]: xfs - fixes found with sparse checking Dave Chinner
2011-12-21 0:07 ` [PATCH 1/2] xfs: clean up minor sparse warnings Dave Chinner
2011-12-21 16:13 ` Christoph Hellwig
2011-12-21 23:59 ` Dave Chinner [this message]
2011-12-22 18:15 ` Ben Myers
2012-02-01 18:33 ` Ben Myers
2011-12-21 0:07 ` [PATCH 2/2] xfs: fix endian conversion issue in discard code Dave Chinner
2011-12-21 4:36 ` Ben Myers
2012-01-06 15:12 ` Christoph Hellwig
2012-01-06 15:38 ` Ben Myers
2011-12-21 16:11 ` Christoph Hellwig
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=20111221235904.GH23662@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.com \
/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