From patchwork Tue Nov 24 08:21:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7688171 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 559C79F2E9 for ; Tue, 24 Nov 2015 08:22:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8CB0A20825 for ; Tue, 24 Nov 2015 08:22:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCA1A2081E for ; Tue, 24 Nov 2015 08:22:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752982AbbKXIVt (ORCPT ); Tue, 24 Nov 2015 03:21:49 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34907 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751730AbbKXIVs (ORCPT ); Tue, 24 Nov 2015 03:21:48 -0500 Received: by pacej9 with SMTP id ej9so14956245pac.2; Tue, 24 Nov 2015 00:21:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=QV3ZKdppgSF5aGAc3U719wy853bvSMoOjuIRdhLsW1E=; b=tA1ABucIe5CB0aLClnjIRbSAtDU4Het/g+1lmvtwcF+ewX+XDTUlWtITb3+5RL6rJu GkFXLjyvelAYp1y1z7Lj3rzqZ5UUkYg1C/TPazPNEQ8zFj3XIDJci5Doiyx6dDWNSyHz Qtzl+aCArWMv3NYb+eOJKZpw2YAG1EupGAWXzOqvhnTo14g2yKZ8eYqvw4Xxc7kpt8NK IRzLcBt/RYzN9V4UXsJi/YKSvkWdnAppFrl37+Kf1utVyI2XM4Y389/WEZxg1AYqgSl8 XvaeUYF/ehaeq/Kab7fdPK6tYeyDgDiagzKxjCTkR77ZYc76KD+Cg5usaVwYOfoDGk6r eKMQ== X-Received: by 10.68.69.106 with SMTP id d10mr40552043pbu.143.1448353307348; Tue, 24 Nov 2015 00:21:47 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([122.169.181.80]) by smtp.gmail.com with ESMTPSA id 1sm12813601pfo.72.2015.11.24.00.21.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Nov 2015 00:21:46 -0800 (PST) From: Sudip Mukherjee To: Kalle Valo Cc: linux-kernel@vger.kernel.org, libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Andy Shevchenko , Sudip Mukherjee Subject: [PATCH v2] libertas: check for NULL before use Date: Tue, 24 Nov 2015 13:51:38 +0530 Message-Id: <1448353298-16110-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If kzalloc fails it will return NULL. Lets check for NULL first before using the pointer. Signed-off-by: Sudip Mukherjee --- v2: commit message changed drivers/net/wireless/marvell/libertas/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/libertas/cfg.c b/drivers/net/wireless/marvell/libertas/cfg.c index 8317afd..e38ad1d 100644 --- a/drivers/net/wireless/marvell/libertas/cfg.c +++ b/drivers/net/wireless/marvell/libertas/cfg.c @@ -1108,7 +1108,7 @@ static int lbs_associate(struct lbs_private *priv, size_t len, resp_ie_len; int status; int ret; - u8 *pos = &(cmd->iebuf[0]); + u8 *pos; u8 *tmp; lbs_deb_enter(LBS_DEB_CFG80211); @@ -1117,6 +1117,7 @@ static int lbs_associate(struct lbs_private *priv, ret = -ENOMEM; goto done; } + pos = &cmd->iebuf[0]; /* * cmd 50 00