Message ID | 20240118094704.212641-1-chentao@kylinos.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-29981-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp229940dyb; Thu, 18 Jan 2024 01:47:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7zICE2tB2rRxv6ByBvn7jE1EoW4PYhPDgpzJthmRG5aRmiFJDFZFG/7E5mb0t4AOIHBhl X-Received: by 2002:a17:906:2451:b0:a28:bf47:27a3 with SMTP id a17-20020a170906245100b00a28bf4727a3mr358889ejb.138.1705571261632; Thu, 18 Jan 2024 01:47:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705571261; cv=pass; d=google.com; s=arc-20160816; b=SE902bCLCYuHfCpJHygqGzeL4WqJQd8IAKyOaxtcrxD/cKXIL4kiU3hP00m9DlHfD9 t50DOyjFIH6ZW9ay0sSywjBIQ8l+c7d+kPoMG4UljNF8jBr1pCOA7CGIjOmVcDWHfPcP eRWIyoP9kIms5EnjEr0xiu+J+ZEiQEVioBydDkoHG97Aug8+EnfUF4pzFION9bbUFSC8 STe+obv/jjFaqimNjvaGHtf6/8k+/cU5/Iv/xn8Kyf2dtV/O9HL7UXWPOmsCjHbejFaw FjC0HAlLsBrWVSeIaP2KB1U5CIpUBM8Gv5Xz0Remsq43RWNNBZAbhdQ/EcrVlzJcvgnB yZMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=gDZRY89ka9X4EEgm7gILelY3NLePJfePrfTPTSWxOXE=; fh=TnaOKGUU1YZPw9yA4/GN4720ueiUIMcohXcerW7E2yQ=; b=lIQQDTbM/NUEbsuuWUJYNWh0m0lXwshAQbV/5MIPMDiZhNXv+MSU10t1KAfvYnMubc G5LDHscz2s7B4Uf9j2x9/XUjm5GRzWFO4G/jP5VwJQ7PFy6sBegdqAiPikKIYQVrVnu7 nav7DTIym/PcBmGXq0LXlxaTb+LKioG7zp1YeJKoARctCwO+eUQt2oYHfDGRGriyR8eu ILC8Uj7dBMI5Bb2Fip3r6GUXgc+4JBV8m8t/QQdH6mTT6pHDxPf4cQxHKZvF9ioE++4K nmsC/KAqhn0mk2voqJcuNK8AjvkbhBy0BRBRY2uMfV/U+SftnHMxxvM5c0FUj5oqBkfJ WdUg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-29981-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29981-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f17-20020a170906139100b00a2e519b0988si2679684ejc.426.2024.01.18.01.47.41 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 01:47:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29981-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-29981-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29981-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 415641F21707 for <ouuuleilei@gmail.com>; Thu, 18 Jan 2024 09:47:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D66612031B; Thu, 18 Jan 2024 09:47:26 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F8891173D; Thu, 18 Jan 2024 09:47:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705571245; cv=none; b=UF1egfU06kpQb2j1ZmQTqwzgiTT+0J+3ct6M3pCHUE41lR7fbqUQUr6UtWRhYwRfmD/IPa8GClC9sUjAFlILDv+MF4GoxGyQGZ1vaeav3NNi8oJoBur3VbfykKA83TDwf3EwkkJlZUflheTkMszBk1rVjFB3nG4I7I8vPLvUZKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705571245; c=relaxed/simple; bh=xUKe/6pES/NscQ+RcGPUqZZ6ve+SBnXl+mH5PIJD128=; h=X-UUID:X-CID-P-RULE:X-CID-O-INFO:X-CID-INFO:X-CID-META:X-CID-BVR: X-CID-BAS:X-CID-FACTOR:X-UUID:Received:Received:X-ns-mid:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=GuU32bhO2fIC4J1g5xbc2zSRnFr5N2kcIze86q5WcvmFs+JGhFHO+uejShYddPHpmAdP9zolZeC+CVeEKWeNpME5JXNCU1rHsQdXTIvsWmnU/S0PB+fHW23N6j3MeKX3+z+MB7Yt0TdSWhCKZCP3PqEj4Sadaa6+fEcT2nfEn4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 3d0cabb88c414149bc8eca0681ee3386-20240118 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:02285d8d-6596-4773-956c-95702a0cee6f,IP:20, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:5 X-CID-INFO: VERSION:1.1.35,REQID:02285d8d-6596-4773-956c-95702a0cee6f,IP:20,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:5 X-CID-META: VersionHash:5d391d7,CLOUDID:c4567d7f-4f93-4875-95e7-8c66ea833d57,B ulkID:240118174709GVOR3L11,BulkQuantity:0,Recheck:0,SF:17|19|44|66|38|24|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,CO L: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_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: 3d0cabb88c414149bc8eca0681ee3386-20240118 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from <chentao@kylinos.cn>) (Generic MTA) with ESMTP id 1667805969; Thu, 18 Jan 2024 17:47:08 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 71955E000EB9; Thu, 18 Jan 2024 17:47:08 +0800 (CST) X-ns-mid: postfix-65A8F39C-245485265 Received: from kernel.. (unknown [172.20.15.234]) by mail.kylinos.cn (NSMail) with ESMTPA id E42E8E000EB9; Thu, 18 Jan 2024 17:47:05 +0800 (CST) From: Kunwu Chan <chentao@kylinos.cn> To: andersson@kernel.org, konrad.dybcio@linaro.org, lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, deller@gmx.de Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn> Subject: [PATCH] hwmon: (peci/cputemp) Add a null pointer check to the wled_configure Date: Thu, 18 Jan 2024 17:47:04 +0800 Message-Id: <20240118094704.212641-1-chentao@kylinos.cn> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788421091332517008 X-GMAIL-MSGID: 1788421091332517008 |
Series |
hwmon: (peci/cputemp) Add a null pointer check to the wled_configure
|
|
Commit Message
Kunwu Chan
Jan. 18, 2024, 9:47 a.m. UTC
devm_kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
drivers/video/backlight/qcom-wled.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index 10129095a4c1..a0b06839d778 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1406,8 +1406,11 @@ static int wled_configure(struct wled *wled) wled->ctrl_addr = be32_to_cpu(*prop_addr); rc = of_property_read_string(dev->of_node, "label", &wled->name); - if (rc) + if (rc) { wled->name = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node); + if (!wled->name) + return -ENOMEM; + } switch (wled->version) { case 3: