Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8989112ybi; Tue, 23 Jul 2019 19:33:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMYgWj3c1ZO0imvbitu26/gqzxoRCyfKVtmbwiyns6a+91D7wedBNmix9Ez4HCVX1NkBaG X-Received: by 2002:a17:902:9a95:: with SMTP id w21mr851927plp.126.1563935622997; Tue, 23 Jul 2019 19:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563935622; cv=none; d=google.com; s=arc-20160816; b=t7/yIex4o/MSFYXkkJfd1ErCXVieRAlzq0cmFlXM53TXnRIROcBKyPBKdyeqt5D2Dm laZOfCYVIMVM2cZtRnBDCQeKIEkHlBjXR0zjMvZ93pTsMGtlZ0bkt3T174NhCgXo5ZaT gA8udqyCi1IJGp7nMLvj/5KbGkBCjv8xGDepN6vIkHJigQZkso244HT7SOuKcb8D9up4 AghIt55JUkrr+OQpDbrYdlSKnKnL0vckHK0CZz3Gst3LzwGD3xHn2tYAU+EnE1eRP81q AzmB5HQPSLrAUUTkrXpXBY9BMo/LZ4w/uwSKHOe2qFscLnmSvC5MIfZvrcDKUWO0C3S/ xV/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=pl9nO+hunkGocGh4P+3+7RACb7n3AOCHKdRk3PRyj78=; b=AyqSD+LbAwZl+bF7pMGlY2NpJ5+C9RNmuR0q9xzE3lpkpW4Chl+TWKOEYGHtH+HrQ6 IaTIPd+NvMQ1Ovh1aUS5UBARbiAPFKWIzthtrlVkv4lrP5p2Zayx3zooDU4oCG79GgPf 72k/wUv7t4rt93gzfnDjwieqOJHLzSXRDL0zk2Sg1MPJO6UrNjI+ASZmcUjBur+Vmiwn H4yV/5+f5lWyUS2IQa7tVL2/voMSigzOsPbRciJ+C5X2lAZd1R9fhCYJGf1flNp6tp6i V4nzAJsJZaBa6Wp6kIuPnLqdkXJFIpYXZBdoPI8Q5cpFjuNxMA1Vu8RmJsQRh/qq70dv ZUDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jClr9tGO; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (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 e9si399306pfi.170.2019.07.23.19.33.20; Tue, 23 Jul 2019 19:33:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jClr9tGO; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728655AbfGWWUH (ORCPT + 99 others); Tue, 23 Jul 2019 18:20:07 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:37705 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbfGWWUG (ORCPT ); Tue, 23 Jul 2019 18:20:06 -0400 Received: by mail-io1-f68.google.com with SMTP id q22so85260524iog.4; Tue, 23 Jul 2019 15:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pl9nO+hunkGocGh4P+3+7RACb7n3AOCHKdRk3PRyj78=; b=jClr9tGO0M2uPdTqgL+wilDjNYPCY1lHULxJyU4k5vGRMTiCplHDR9talFGARjm7fM WaQzedbOLIChWY2xd0aavGY1YIl0rc4yFY1QjuAdhFpLnHbnquNpQhnyWdCtpD/yh0wj mic0mlosfXm6fh2jHggFADTo3xWjod0o0w9F7sh+It2QAgSNWfwcfcRKhDg4DFqN94+h ji0X4ENlzZZuWoW70qUl9zRrs75DGINQ0bLoXjHq010Tx1Ahq71E4+ryf93RiyEK95rp YvkGkm2a3vss0Nk42AMTYFrs7VsYkuxBS7APMVVSARpeApcEDLQ/NmTZMcXqTLfb6OxH OCfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pl9nO+hunkGocGh4P+3+7RACb7n3AOCHKdRk3PRyj78=; b=cZSQ1ymJOy2X/xkGh0cvvKuov+L6j5K/GMoQjbV8MCDhB4kHd6sxqexUaU8uK+mmVe XlenphHDTpDqh5pMWhdDwsTWWoywYlIDjTmaR1HRt7y/mreLelPNlGTqGjvU7ONFR7eJ Rl8cK46GpH5vCUGZ7lAfXH526Im3U9R77rUgvwkrrTDFAn3k3vYk7Je7x5aD6LnC+P7n lN3vW18UQflGGrVR/HMZfGF+0Za/5On2FfbckbB7KmqTYMLRskuiYn9Y4jnXG04/ucJl BmolN/r+K72FLAB6fNVsBX71w58neOfQ0LSR2vS3x60taSEAoHikqcYdJ3b6sW/GgJ9w +jRw== X-Gm-Message-State: APjAAAUqo0mM0+S1z9lxxmMgQFoDviDNkl1XNMAAu0IdAFbMcmtvK5Xv xubjzGcDZnkaNZsiWUZE7ow= X-Received: by 2002:a5e:c241:: with SMTP id w1mr68853307iop.58.1563920405893; Tue, 23 Jul 2019 15:20:05 -0700 (PDT) Received: from cs-dulles.cs.umn.edu (cs-dulles.cs.umn.edu. [128.101.35.54]) by smtp.googlemail.com with ESMTPSA id x22sm33378952iob.84.2019.07.23.15.20.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jul 2019 15:20:05 -0700 (PDT) From: Navid Emamdoost Cc: emamd001@umn.edu, kjlu@umn.edu, smccaman@umn.edu, secalert@redhat.com, Navid Emamdoost , Jakub Kicinski , Kalle Valo , "David S. Miller" , Matthias Brugger , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] mt76_init_sband_2g: null check the allocation Date: Tue, 23 Jul 2019 17:19:54 -0500 Message-Id: <20190723221954.9233-1-navid.emamdoost@gmail.com> X-Mailer: git-send-email 2.17.1 To: unlisted-recipients:; (no To-header on input) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org devm_kzalloc may fail and return NULL. So the null check is needed. Signed-off-by: Navid Emamdoost --- drivers/net/wireless/mediatek/mt7601u/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt7601u/init.c b/drivers/net/wireless/mediatek/mt7601u/init.c index 9bfac9f1d47f..cada48800928 100644 --- a/drivers/net/wireless/mediatek/mt7601u/init.c +++ b/drivers/net/wireless/mediatek/mt7601u/init.c @@ -557,6 +557,9 @@ mt76_init_sband_2g(struct mt7601u_dev *dev) { dev->sband_2g = devm_kzalloc(dev->dev, sizeof(*dev->sband_2g), GFP_KERNEL); + if (!dev->sband_2g) + return -ENOMEM; + dev->hw->wiphy->bands[NL80211_BAND_2GHZ] = dev->sband_2g; WARN_ON(dev->ee->reg.start - 1 + dev->ee->reg.num > -- 2.17.1