From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8C9BC1350CA; Tue, 23 Jan 2024 01:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971944; cv=none; b=Iiz0qpwJx7Hqe/pIGwWqSGYunlbrHpcr6UkdbR3BJO5xFhV8oCLubc/6GIbEn16t+BeW6RSyhPln1miJnvWCwaKjrxkLZbI1bUKbgsJDMP1/sFNGU5woMZexIUBvrTKYpmJfMBYQ9oqwRWDvAma96+N+hwZ7Wfe106X1sfsiUXM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705971944; c=relaxed/simple; bh=LXRYKtgJZa6tij/vb/SIIYcIob9sXiJxWWBayO8wqAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e7MdYxvkziUnwfPeWQo+ieqscSVpFCVZTTkbiYFRXvCLGOpH5vKFe2fa8qJ13HVH/UWND12actMele7skAyITiEdBYsWLSa/foIAkQQY3S1VBxaPoJfhGB2kO/Ia7LrgRel8hAols2ddPKZoYom+kgELO+j3c/yLs1JX32Oz2kk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xI5yQipM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xI5yQipM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C836C433F1; Tue, 23 Jan 2024 01:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705971944; bh=LXRYKtgJZa6tij/vb/SIIYcIob9sXiJxWWBayO8wqAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xI5yQipMEgV3gQVk9yslOEZ4eViZyr7GYJy9nd5OCodPGGXcOzCX9KbLweiP5rwS0 9QbKBLVHUTwBHuujs8Iv+eUMAd2S2ynki5nhBK+WkrBg/J/9oeDDdPkC6CtcT2OFF3 smIK+ic3YupWSHZh0BfcygqEbvlwjqexaqFPMLJ4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kunwu Chan , Jakub Kicinski , Simon Horman , Sasha Levin Subject: [PATCH 5.10 270/286] net: dsa: vsc73xx: Add null pointer check to vsc73xx_gpio_probe Date: Mon, 22 Jan 2024 15:59:36 -0800 Message-ID: <20240122235742.455951408@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235732.009174833@linuxfoundation.org> References: <20240122235732.009174833@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kunwu Chan [ Upstream commit 776dac5a662774f07a876b650ba578d0a62d20db ] devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Fixes: 05bd97fc559d ("net: dsa: Add Vitesse VSC73xx DSA router driver") Signed-off-by: Kunwu Chan Suggested-by: Jakub Kicinski Reviewed-by: Simon Horman Link: https://lore.kernel.org/r/20240111072018.75971-1-chentao@kylinos.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/dsa/vitesse-vsc73xx-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index 80eadf509c0a..018988b95035 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -1119,6 +1119,8 @@ static int vsc73xx_gpio_probe(struct vsc73xx *vsc) vsc->gc.label = devm_kasprintf(vsc->dev, GFP_KERNEL, "VSC%04x", vsc->chipid); + if (!vsc->gc.label) + return -ENOMEM; vsc->gc.ngpio = 4; vsc->gc.owner = THIS_MODULE; vsc->gc.parent = vsc->dev; -- 2.43.0