Message ID | 20231211033019.238149-1-chentao@kylinos.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6813043vqy; Sun, 10 Dec 2023 19:32:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFzmjvvIRag0DBr3lsYhEgKU1ssDnhgCz8ViyPEMT7YQPa99oOlqRveDsNZZzOmZQ2ojGw X-Received: by 2002:a05:6830:168c:b0:6d8:74e2:c08c with SMTP id k12-20020a056830168c00b006d874e2c08cmr4530547otr.62.1702265559006; Sun, 10 Dec 2023 19:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702265558; cv=none; d=google.com; s=arc-20160816; b=jfrbfe0YngxPo6BPg1tuuYrRkp/2mYyT+Aagwzwfo5s7a6nThwNFyjp0FjsTA5B957 BxY6mJCEhSa/y+jMINbbgRSx+syLX7U2ZStIBhy4nMtoOeI4dd1OSo8ms6atVWv3NQL+ XI4t7+J9PqtJSC8g1ryeyqf3r3w+qjLEGbfyIXLvkjw7RC44EPC4+OA/TemHzvzZCHzq dXBTC0lLe7Wk8aAuKsdFFdJxqz7pgFjxysjgmLpLSJNCSsnP8qqFNw1q85/1VITfIrM3 2WQdQYG7xtwNu9DRxCmY73Q9K7wpRGBHltfNP2h4zORuvNgqgJx9ytqi8gx9Mk5emqhF 4Oyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=HP278XC+0QRvCSOmze8wwH/Yr9ipkHCYKYBlFMcrXis=; fh=aXSuAT9fGSvNUksW0aSuZOZbg3pxLWmea7T1bLbvkVc=; b=oOo4o9MmOjSYts+KoCzqriLdeSigqyb2kmgA1jBgqU8DGn3vvWVccjSfxWRStW8oaE Iwpu4jOaeXSadm70uznBj+J2tvspfd7nAThgkryX7KC5trhqTkKs4ZcOwLYARPaWwKDg LGuzChuspRdwW/rV+6RAmJ/zR+z5mIsoJcQYEE8vMstdFMzA++s5cee7SRmx8kfwTYih u7uX8OENgjl0pv9Ew2RYFxtINZYWTj7BrziAUxdvr8nn2vaPaBrixjoeF9IW/9M1BL8I ZWt1BhWkOj4JoS00UySjRnOSSyDqQi2UY8o2vczWWtMgMfco8SeqmtFHQXKf6Teghxix rzJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id s24-20020a63f058000000b005c6b4e190b0si5303630pgj.530.2023.12.10.19.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 19:32:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C3085806532F; Sun, 10 Dec 2023 19:32:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229589AbjLKDan (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Sun, 10 Dec 2023 22:30:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjLKDam (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 10 Dec 2023 22:30:42 -0500 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B38FE9; Sun, 10 Dec 2023 19:30:47 -0800 (PST) X-UUID: 8c610b21d4dd43e78e60a6bfbc3acfb6-20231211 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.33,REQID:11677d22-57f1-4fa4-b5f8-bee90eef913c,IP:5,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-10 X-CID-INFO: VERSION:1.1.33,REQID:11677d22-57f1-4fa4-b5f8-bee90eef913c,IP:5,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:-10 X-CID-META: VersionHash:364b77b,CLOUDID:b30405bd-2ac7-4da2-9f94-677a477649d9,B ulkID:231211113033ZT95PL27,BulkQuantity:0,Recheck:0,SF:44|66|38|24|17|19|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil ,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_ULN,TF_CID_SPAM_SNR, TF_CID_SPAM_FAS X-UUID: 8c610b21d4dd43e78e60a6bfbc3acfb6-20231211 X-User: chentao@kylinos.cn Received: from vt.. [(116.128.244.169)] by mailgw (envelope-from <chentao@kylinos.cn>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 278654567; Mon, 11 Dec 2023 11:30:31 +0800 From: Kunwu Chan <chentao@kylinos.cn> To: stf_xl@wp.pl, kvalo@kernel.org Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn>, Kunwu Chan <kunwu.chan@hotmail.com> Subject: [PATCH] iwlegacy: Add null pointer check to il_leds_init Date: Mon, 11 Dec 2023 11:30:19 +0800 Message-Id: <20231211033019.238149-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 10 Dec 2023 19:32:36 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784954810774917767 X-GMAIL-MSGID: 1784954810774917767 |
Series |
iwlegacy: Add null pointer check to il_leds_init
|
|
Commit Message
Kunwu Chan
Dec. 11, 2023, 3:30 a.m. UTC
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.
Cc: Kunwu Chan <kunwu.chan@hotmail.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
drivers/net/wireless/intel/iwlegacy/common.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Mon, Dec 11, 2023 at 11:30:19AM +0800, Kunwu Chan wrote: > kasprintf() returns a pointer to dynamically allocated memory > which can be NULL upon failure. > > Cc: Kunwu Chan <kunwu.chan@hotmail.com> > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl> > --- > drivers/net/wireless/intel/iwlegacy/common.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c > index 054fef680aba..17570d62c896 100644 > --- a/drivers/net/wireless/intel/iwlegacy/common.c > +++ b/drivers/net/wireless/intel/iwlegacy/common.c > @@ -541,6 +541,9 @@ il_leds_init(struct il_priv *il) > > il->led.name = > kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy)); > + if (!il->led.name) > + return; > + > il->led.brightness_set = il_led_brightness_set; > il->led.blink_set = il_led_blink_set; > il->led.max_brightness = 1; > -- > 2.39.2 >
Kunwu Chan <chentao@kylinos.cn> wrote: > kasprintf() returns a pointer to dynamically allocated memory > which can be NULL upon failure. > > Cc: Kunwu Chan <kunwu.chan@hotmail.com> > Signed-off-by: Kunwu Chan <chentao@kylinos.cn> > Acked-by: Stanislaw Gruszka <stf_xl@wp.pl> Patch applied to wireless-next.git, thanks. afd549903ea9 wifi: iwlegacy: Add null pointer check to il_leds_init()
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c index 054fef680aba..17570d62c896 100644 --- a/drivers/net/wireless/intel/iwlegacy/common.c +++ b/drivers/net/wireless/intel/iwlegacy/common.c @@ -541,6 +541,9 @@ il_leds_init(struct il_priv *il) il->led.name = kasprintf(GFP_KERNEL, "%s-led", wiphy_name(il->hw->wiphy)); + if (!il->led.name) + return; + il->led.brightness_set = il_led_brightness_set; il->led.blink_set = il_led_blink_set; il->led.max_brightness = 1;