Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2650327imj; Mon, 11 Feb 2019 06:28:39 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibv8bgMdxlQlDDtDG6ezGr+dshz4VjYAMtI98UT4JOewxE2Cj7kR0cPey/9tevNvzR77PGs X-Received: by 2002:a63:2d43:: with SMTP id t64mr12953299pgt.155.1549895319403; Mon, 11 Feb 2019 06:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895319; cv=none; d=google.com; s=arc-20160816; b=Qn/5f4u30+xmIoHM3Y7glm91ERMwF98XsFqdJjg1iZDTAoP0dclY+mXqOrmHX3mt1w rwTYOsjLc3h4owDpqejecTUgcfe/s+5R4OVi+tDTV4hcqCOx/alyr5CNMjqDqlJLt7I5 17AuPHGK8HlPfQ/Kv2VxJmx2lWuyNJO+uF7Zq26drfEzJS9yRDEfPgyrcqMVJotfnXD9 9D97qK/5PCjIjuI1cV0hNqaoTM1h4ArKWWnDXkUmSsAx7b54I4OHWuzwOWQHAskQ4aZG b+P7HQ9J/esutwBM50WwhKLc66z+pRPRY4xBCzZBlSOtq9YTby+lCiDFGoIz2P15V5dK 7ZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gZmtYh19D0yXXYa5RZfriT3w+sopWzHmvESWtqrMpg4=; b=g6Bhhzn69OwO/ieFNCyCPGkqdNidU/6Pb92rP/8hirvQn3NKuN3wggYwyJ4KhOqDKb nP0QbHjsktdEMP0GH7dV7Ww+BiOkR0VUK74y57KOZXJSgGG8aZD/8aH0rjuTddRrPKHJ m/ZdJq/ghnnJfdTF6p2VYO1sQ1uO4+CtGeOUnOCahSiZ5YecAfS4w5eaCZuGs3SQnHFb y5j2KqrbDOlETmiU1qmRIGRdyqparOhd0MoguGaWIF4lHjc7lJQR9SY6u7F/BcChcLBy pCkHqQ8MZ3njZOJpH2fHFMnJroDTjvtbwD33EawcL4dATjjbyPjtdS46tMx+TTBylSRZ oQ1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zObQTEUt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si9976135pll.343.2019.02.11.06.28.23; Mon, 11 Feb 2019 06:28:39 -0800 (PST) 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=@kernel.org header.s=default header.b=zObQTEUt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729551AbfBKO0X (ORCPT + 99 others); Mon, 11 Feb 2019 09:26:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:60040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727236AbfBKO0Q (ORCPT ); Mon, 11 Feb 2019 09:26:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2026D20838; Mon, 11 Feb 2019 14:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895175; bh=AaxbHy0b+4seBHfJiloA2E6VY/47av3S3drPFAc7384=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zObQTEUtxO74PADj4aYuB/TeB4UUY8x81b+1rSnJ1dbHfQmSNd0IEnCBWRnQnPxfX tNGaGYAQzP8zEub1B5jKgBbuB5Y6Ofenc6H1Zbv8lncOs0pniHq/DOYmAW3Hl1in8U RD2Ar9KtK2amGsmgm9ElAZ67P6x+5vU4Vf8jF49c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Mc Guire , Linus Walleij , Sasha Levin Subject: [PATCH 4.20 119/352] pinctrl: nuvoton: check for devm_kasprintf() failure Date: Mon, 11 Feb 2019 15:15:46 +0100 Message-Id: <20190211141853.621905595@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 4be1eaf322f07bb9694618fd2763a3a1f0a3dd25 ] devm_kasprintf() may return NULL on failure of internal allocation thus the assignment to .label is not safe if not checked. On error npcm7xx_gpio_of() returns negative values so -ENOMEM in the (unlikely) failure case of devm_kasprintf() should be fine here. Signed-off-by: Nicholas Mc Guire Fixes: 3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver") Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c index 7ad50d9268aa..3bda620d18bb 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c @@ -1932,6 +1932,9 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl) pctrl->gpio_bank[id].gc.label = devm_kasprintf(pctrl->dev, GFP_KERNEL, "%pOF", np); + if (pctrl->gpio_bank[id].gc.label == NULL) + return -ENOMEM; + pctrl->gpio_bank[id].gc.dbg_show = npcmgpio_dbg_show; pctrl->gpio_bank[id].direction_input = pctrl->gpio_bank[id].gc.direction_input; -- 2.19.1