All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Joel Becker <joel.becker@oracle.com>,
	James Morris <jmorris@namei.org>, Christoph Hellwig <hch@lst.de>,
	linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] btrfs: add check for ERR_PTR()
Date: Wed, 21 Apr 2010 12:32:04 +0200	[thread overview]
Message-ID: <20100421103204.GD29647@bicker> (raw)

posix_acl_from_xattr() can sometimes return an ERR_PTR().

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 6ef7b26..c6d84ce 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -60,7 +60,8 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 		size = __btrfs_getxattr(inode, name, value, size);
 		if (size > 0) {
 			acl = posix_acl_from_xattr(value, size);
-			set_cached_acl(inode, type, acl);
+			if (!IS_ERR(acl))
+				set_cached_acl(inode, type, acl);
 		}
 		kfree(value);
 	} else if (size == -ENOENT || size == -ENODATA || size == 0) {

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Joel Becker <joel.becker@oracle.com>,
	James Morris <jmorris@namei.org>, Christoph Hellwig <hch@lst.de>,
	linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] btrfs: add check for ERR_PTR()
Date: Wed, 21 Apr 2010 10:32:04 +0000	[thread overview]
Message-ID: <20100421103204.GD29647@bicker> (raw)

posix_acl_from_xattr() can sometimes return an ERR_PTR().

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 6ef7b26..c6d84ce 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -60,7 +60,8 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
 		size = __btrfs_getxattr(inode, name, value, size);
 		if (size > 0) {
 			acl = posix_acl_from_xattr(value, size);
-			set_cached_acl(inode, type, acl);
+			if (!IS_ERR(acl))
+				set_cached_acl(inode, type, acl);
 		}
 		kfree(value);
 	} else if (size = -ENOENT || size = -ENODATA || size = 0) {

             reply	other threads:[~2010-04-21 10:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 10:32 Dan Carpenter [this message]
2010-04-21 10:32 ` [patch] btrfs: add check for ERR_PTR() Dan Carpenter

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=20100421103204.GD29647@bicker \
    --to=error27@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=hch@lst.de \
    --cc=jmorris@namei.org \
    --cc=joel.becker@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.