Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1228818ybh; Sat, 3 Aug 2019 21:07:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxz3T9wrV7m5gK9p2+hbodOJEYcEUxqC38xtNV3Bn5vEJmETsilrKoHnhJX+Bjo6QQrQY2l X-Received: by 2002:a63:5754:: with SMTP id h20mr89402227pgm.195.1564891674719; Sat, 03 Aug 2019 21:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564891674; cv=none; d=google.com; s=arc-20160816; b=m3gOSQcCQVegZ4AbBR8WJTLSyQRweI5BtzDvz9wGbwQOIiZYnnos0GWT+JVqrgRkgE F+E8kwYUvKyBIxoypD16nbhvAG6ChvAta3b5QG0YJlwfr/9//tI0ujNSjnuH40iUkIxm knfbKS9xm8/9QBVekpxA3P9PuJscaZnKlzIsCrI3ibZw5ykcbqeNPI9D+JyIfdngBdT0 x3pyER5P4G7DVGGvBSUepSXthSL9GQD27C8J3TYygQFcL3YgNN1HNi7j8WdktkLxF5qJ RVvGSwHPIVI3fX9SnLCJQPOlQOwv54Ys796o8/+oIbXLLGiovJ0EA2HzLcoQXojNNls6 LoFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date:dkim-signature; bh=qPpsx0lZXSAze2smB67N23Z3ac9MnBXGfrM+XLrnXhY=; b=QVmdmD7hXe3XVk6iYMhOqhiqJ2XCe1LgOUTSjjzW3aetlBwcuxW9uMN4kRvPp2iVDV MWT6w64nwDyKtI7N7umRB3Avo0RVrrologbe/x/GXf7YeOFHuvORulzBFMrSl5myKjDU reg6DetU/KDl3+5atxQ4DdC60yUbehekPBGLlWuf2lVNd37Ovyrb6+EXjs/IXfJE4NtB 4V8E2xQqHx+VtfpHxOEsir63a2xFHKgB+M3tOM8rHCZ2kwMLMNXOCmtZwLlKw8GFtmpc uL6CGrRiH4vSiyubve+QhIbD+eV/bGS0D6KEGUffGdCJF99LEhm3zPIBLCNMy5BEnL4n FU3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xa5XhcGO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o63si9820036pjo.94.2019.08.03.21.07.40; Sat, 03 Aug 2019 21:07:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xa5XhcGO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725807AbfHDDtL (ORCPT + 99 others); Sat, 3 Aug 2019 23:49:11 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46551 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbfHDDtL (ORCPT ); Sat, 3 Aug 2019 23:49:11 -0400 Received: by mail-pg1-f194.google.com with SMTP id w3so778397pgt.13 for ; Sat, 03 Aug 2019 20:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=qPpsx0lZXSAze2smB67N23Z3ac9MnBXGfrM+XLrnXhY=; b=Xa5XhcGOqYQkHtIrimdKrUWMsV6UxQFF5NYX6yKSzHGH4atjizk4EvZMqs0Gd5TaqS FyYWb3okHzvS24/7w9/CdXDQwIYPsVWzvB+KGU+aUWqqEUmYuupI5RRrpk0Gw3ntb2Ux vnPJNSWjenG06l3tHrSJqAYe6XkMz1oTW7hMeBaSadW66KcpEgf1I/Ohs2/NNsRTYzUI 9VW7FJ36K8jJGeEQwqNs867a0Jvofh7lsNpU2NnhmeMPP4z8LPQohcBwVD/bbszwYT7i Q8PUKXUir1HdtT4SVOUGDU0qBsnV333B0xXhDzt5rE3FzfB6ccYL/8ee/e3YLrudG1Te eWRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=qPpsx0lZXSAze2smB67N23Z3ac9MnBXGfrM+XLrnXhY=; b=RdEh+Skul8WK+MwwbkvQXVhzX6oIlQPVbW3vB0bHNznDkrFlFwMCfuk+NTWJJ4wXGC +cuc19tnizu36/ufkVPHy0+JsC+iO2cmxDIicAfU4vx9EkmD74HBKyKbQaENj1JbNXzV adYrzXFZgeik8CwXEQAQEXsN385/p1BOKd+GU+OzSHNrJ2FeSGP6zEcmNBpVt4OpUu0k g498AQLWrt6Iv/0YoC3CwAuhxz2UUsrOOyni3YZ8/fvqaDBetwm7zueNvXRku3vtmloG nyhzY0YEzOzXi6mWmGh3PRN/PMU1Pgn8VyN221k7qVc1aMWid6ri/LFpradJMhk8KU5O 4Ifw== X-Gm-Message-State: APjAAAX8XIfQa5yepqzY7K1Ze3AuAnRG9d4MYJ2sYHRXnkwaJp5f44st rWO12L1hXGP5VlmaMYgI8W5gzn8V X-Received: by 2002:a63:3c5:: with SMTP id 188mr128318137pgd.394.1564890550467; Sat, 03 Aug 2019 20:49:10 -0700 (PDT) Received: from hari-Inspiron-1545 ([183.83.86.126]) by smtp.gmail.com with ESMTPSA id a21sm88482666pfi.27.2019.08.03.20.49.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Aug 2019 20:49:09 -0700 (PDT) Date: Sun, 4 Aug 2019 09:19:05 +0530 From: Hariprasad Kelam To: Greg Kroah-Hartman , John Whitmore , Nishka Dasgupta , Colin Ian King , Hariprasad Kelam , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: rtl8192u: Add NULL check post kzalloc Message-ID: <20190804034904.GA16513@hari-Inspiron-1545> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Collect returns status of kzalloc. Signed-off-by: Hariprasad Kelam --- drivers/staging/rtl8192u/r8192U_core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index fe1f279..3240442 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -2096,7 +2096,7 @@ static void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode) } /* init priv variables here. only non_zero value should be initialized here. */ -static void rtl8192_init_priv_variable(struct net_device *dev) +static int rtl8192_init_priv_variable(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); u8 i; @@ -2223,6 +2223,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev) priv->AcmControl = 0; priv->pFirmware = kzalloc(sizeof(rt_firmware), GFP_KERNEL); + if (!priv->pFirmware) + return -ENOMEM; /* rx related queue */ skb_queue_head_init(&priv->rx_queue); @@ -2236,6 +2238,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev) for (i = 0; i < MAX_QUEUE_SIZE; i++) skb_queue_head_init(&priv->ieee80211->skb_drv_aggQ[i]); priv->rf_set_chan = rtl8192_phy_SwChnl; + + return 0; } /* init lock here */ @@ -2605,7 +2609,11 @@ static short rtl8192_init(struct net_device *dev) memcpy(priv->txqueue_to_outpipemap, queuetopipe, 9); } #endif - rtl8192_init_priv_variable(dev); + err = rtl8192_init_priv_variable(dev); + if (err) { + DMESG("init private variables failed"); + return err; + } rtl8192_init_priv_lock(priv); rtl8192_init_priv_task(dev); rtl8192_get_eeprom_size(dev); -- 2.7.4