From patchwork Mon Aug 22 14:16:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 1085522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7MEGglb030636 for ; Mon, 22 Aug 2011 14:16:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752957Ab1HVOQV (ORCPT ); Mon, 22 Aug 2011 10:16:21 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:35811 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670Ab1HVOQU (ORCPT ); Mon, 22 Aug 2011 10:16:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 8683B19BC39; Mon, 22 Aug 2011 16:16:19 +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 13070-05; Mon, 22 Aug 2011 16:16:15 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 3B9C519BC2A; Mon, 22 Aug 2011 16:16:15 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 7F25E6DF894; Mon, 22 Aug 2011 16:15:19 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id F16E9826EA; Mon, 22 Aug 2011 16:16:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id B122F800FD; Mon, 22 Aug 2011 16:16:14 +0200 (CEST) Date: Mon, 22 Aug 2011 16:16:14 +0200 (CEST) From: Julia Lawall To: Pierre Louis Aublin Cc: Bing Zhao , 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 In-Reply-To: <4E52638C.8080407@inria.fr> Message-ID: References: <1314021636-11528-4-git-send-email-julia@diku.dk> <4E52638C.8080407@inria.fr> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 22 Aug 2011 14:16:42 +0000 (UTC) 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 Acked-by: Bing Zhao --- drivers/net/wireless/mwifiex/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" 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..37ca2f9 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c @@ -1480,8 +1480,8 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, return -ENOMEM; } beacon_ie = kzalloc(ie_len, GFP_KERNEL); - if (!bss_desc) { - dev_err(priv->adapter->dev, " failed to alloc bss_desc\n"); + if (!beacon_ie) { + dev_err(priv->adapter->dev, " failed to alloc beacon_ie\n"); return -ENOMEM; } memcpy(beacon_ie, ie_buf, ie_len);