From patchwork Mon Aug 22 14:00:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 110925 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2B994B6F68 for ; Tue, 23 Aug 2011 00:01:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838Ab1HVOBX (ORCPT ); Mon, 22 Aug 2011 10:01:23 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:48328 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752238Ab1HVOAp (ORCPT ); Mon, 22 Aug 2011 10:00:45 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 280A919BB80; Mon, 22 Aug 2011 16:00:44 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12677-09; Mon, 22 Aug 2011 16:00:36 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id 7D34119BC34; Mon, 22 Aug 2011 16:00:36 +0200 (CEST) From: Julia Lawall To: Bing Zhao Cc: kernel-janitors@vger.kernel.org, "John W. Linville" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] drivers/net/wireless/mwifiex/scan.c: test the just-initialized value Date: Mon, 22 Aug 2011 16:00:36 +0200 Message-Id: <1314021636-11528-4-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Julia Lawall Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(...); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { ... when != x return ...; } ) // Signed-off-by: Julia Lawall --- drivers/net/wireless/mwifiex/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index b28241c..d3111c9 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c @@ -1480,7 +1480,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, return -ENOMEM; } beacon_ie = kzalloc(ie_len, GFP_KERNEL); - if (!bss_desc) { + if (!beacon_ie) { dev_err(priv->adapter->dev, " failed to alloc bss_desc\n"); return -ENOMEM; }