From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932419Ab2INTfw (ORCPT ); Fri, 14 Sep 2012 15:35:52 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:43461 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932327Ab2INTfp (ORCPT ); Fri, 14 Sep 2012 15:35:45 -0400 From: Sasha Levin To: tj@kernel.org Cc: aris@redhat.com, dan.carpenter@oracle.com, fengguang.wu@intel.com, linux-kernel@vger.kernel.org, Sasha Levin Subject: [PATCH 2/2] xattr: prevent NULL ptr deref warnings in __simple_xattr_set Date: Fri, 14 Sep 2012 21:35:54 +0200 Message-Id: <1347651354-16289-2-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347651354-16289-1-git-send-email-levinsasha928@gmail.com> References: <1347651354-16289-1-git-send-email-levinsasha928@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Prevent warnings generated by smatch due to unchecked dereference of 'new_xattr' in __simple_xattr_set(). Signed-off-by: Sasha Levin --- 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