mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: tj@kernel.org
Cc: aris@redhat.com, dan.carpenter@oracle.com,
	fengguang.wu@intel.com, linux-kernel@vger.kernel.org,
	Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH 2/2] xattr: prevent NULL ptr deref warnings in __simple_xattr_set
Date: Fri, 14 Sep 2012 21:35:54 +0200	[thread overview]
Message-ID: <1347651354-16289-2-git-send-email-levinsasha928@gmail.com> (raw)
In-Reply-To: <1347651354-16289-1-git-send-email-levinsasha928@gmail.com>

Prevent warnings generated by smatch due to unchecked dereference of
'new_xattr' in __simple_xattr_set().

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xattr.c b/fs/xattr.c
index 508ec1d..f24e5d5 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -880,7 +880,7 @@ static int __simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
 	if (flags & XATTR_REPLACE) {
 		xattr = new_xattr;
 		err = -ENODATA;
-	} else {
+	} else if (new_xattr) {
 		list_add(&new_xattr->list, &xattrs->head);
 		xattr = NULL;
 	}
-- 
1.7.12


  reply	other threads:[~2012-09-14 19:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 19:35 [PATCH 1/2] Revert "xattr: mark variable as uninitialized to make both gcc and smatch happy" Sasha Levin
2012-09-14 19:35 ` Sasha Levin [this message]
2012-09-14 20:54   ` [PATCH 2/2] xattr: prevent NULL ptr deref warnings in __simple_xattr_set Tejun Heo
2012-09-14 20:55     ` Tejun Heo
2012-09-14 20:58       ` Aristeu Rozanski
2012-10-09 18:52         ` Sasha Levin
2012-10-15 13:16           ` Aristeu Rozanski
2012-09-14 20:05 ` [PATCH 1/2] Revert "xattr: mark variable as uninitialized to make both gcc and smatch happy" Aristeu Rozanski
2012-09-15 12:43 ` 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=1347651354-16289-2-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=aris@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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

all inboxes | Powered by JetHome®