lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 13 Jul 2009 12:10:05 +0200 (CEST)
From:	Julia Lawall <julia@...u.dk>
To:	felixb@....com, xfs-masters@....sgi.com, xfs@....sgi.com,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] fs/xfs: Drop unnecessary NULL test

From: Julia Lawall <julia@...u.dk>

The result of container_of should not be NULL.  In particular, in this case
the argument to the enclosing function has passed though INIT_DELAYED_WORK,
which dereferences it, implying that its container cannot be NULL.

The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression x,e;
@@
x = container_of(...)
... when != x = e
* x == NULL
// </smpl>

Signed-off-by: Julia Lawall <julia@...u.dk>

---
 fs/xfs/xfs_mru_cache.c              |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_mru_cache.c b/fs/xfs/xfs_mru_cache.c
index 4b0613d..0651ce7 100644
--- a/fs/xfs/xfs_mru_cache.c
+++ b/fs/xfs/xfs_mru_cache.c
@@ -280,8 +280,8 @@ _xfs_mru_cache_reap(
 	xfs_mru_cache_t		*mru = container_of(work, xfs_mru_cache_t, work.work);
 	unsigned long		now, next;
 
-	ASSERT(mru && mru->lists);
-	if (!mru || !mru->lists)
+	ASSERT(mru->lists);
+	if (!mru->lists)
 		return;
 
 	spin_lock(&mru->lock);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ