From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755340AbZGMKKM (ORCPT ); Mon, 13 Jul 2009 06:10:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755301AbZGMKKK (ORCPT ); Mon, 13 Jul 2009 06:10:10 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:41802 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755279AbZGMKKJ (ORCPT ); Mon, 13 Jul 2009 06:10:09 -0400 Date: Mon, 13 Jul 2009 12:10:05 +0200 (CEST) From: Julia Lawall To: felixb@sgi.com, xfs-masters@oss.sgi.com, xfs@oss.sgi.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] fs/xfs: Drop unnecessary NULL test Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall 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/) // @@ expression x,e; @@ x = container_of(...) ... when != x = e * x == NULL // Signed-off-by: Julia Lawall --- 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);