Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp883642pxk; Thu, 17 Sep 2020 20:17:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX0muH1dPnKBhx6fylmzztr6wZ8oBD7nT6dgRyBOtCRDEW55OeVj2PXadi7wpPkebWb78Y X-Received: by 2002:a17:906:a2d9:: with SMTP id by25mr34833051ejb.326.1600399023864; Thu, 17 Sep 2020 20:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600399023; cv=none; d=google.com; s=arc-20160816; b=KR8bYqZocheYlqxU8LZcdDYQzbPMy4iDCkTTUDjqPItltWGzhbGz72Mn66UFRni8GC oEpYbp+CIzh2Hh6G5qwNS8AjRkPfoH90Ya2Nsk3HBuMjE6JqBDHMbpSQEJtp0CvoVnhl eJ9I934g0+9rXu6JFH9eSUuWA6nZJlzlLFMF0+QuM9/rwUi4NrrUpF4oS+A4nUkqLAiP kbCj1JQfbYM6VMRKjE4c9VhDDFjCRrHOs294KHaP6L7OL/EJAM7xqUZg00Cl2rfktsVP FtzKPbUIOZF3MxzFDKSqQauw+6kXuSuhDzKzrAq40/MrYbXoxBUlPFh2OSnlFqvf5sOO qqBA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AQUKWzW6aLn4R5BuZIjOQZ13Xr/rPZ6WIeZToyA7Vg8=; b=uBzgvqLHuPSj0pAMQhD0Q2dNtm18Ftib8eH6E+NQP27v7zgZwQ5nl1txHMnTkeTNhY GT5CC49DdVsYsMr+cQYl1T0JBSv4Te49umpoKqFAaaO1dAD4hfUn7nT4qL4+tI4yv2X9 oY2BIvoMlDFmg54tIe/LXtz5LtcR9F71zgPewzaSfU6LTSuVOJOXKJ8mNBy/sN9EGxQr +bmCWR+xFKYLImstx9Seu2/Zn1aDN73AjpAnoXd3BmqLgMxiN23wkKNjjHSK8q8RQ42B h4MTuL1rrGxOc6BRWdwB47kKruInSpE5QJzMTPZdkwU9H/ClxHPS2UkxP9C/zk8gxeOv SuIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cjtqmMaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si1158744edv.344.2020.09.17.20.16.40; Thu, 17 Sep 2020 20:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cjtqmMaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730740AbgIRDNq (ORCPT + 99 others); Thu, 17 Sep 2020 23:13:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:46538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbgIRCBx (ORCPT ); Thu, 17 Sep 2020 22:01:53 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6BD021973; Fri, 18 Sep 2020 02:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394512; bh=TbwRRcbFWiuMB8dfF8YlJolXDH48+LAChbI07sEfkpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjtqmMaMvz67F9mJQ/qrGrmcar9QdL8HRSfFiQO3zB1gIkfanYyNNWdE+m2HQadSY CPVO1rDRzG4E7d2hh3FMWCyKFYFhGKL0L5C5p9Vi74zcfMXnANUwtYKq7XLmOjL6wR yvfkbLOPRf22NStlS4bPb2REbXr0bwKpeecnjRI8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephen Kitt , Tony Lindgren , Stephen Boyd , Sasha Levin , linux-omap@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 035/330] clk/ti/adpll: allocate room for terminating null Date: Thu, 17 Sep 2020 21:56:15 -0400 Message-Id: <20200918020110.2063155-35-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Kitt [ Upstream commit 7f6ac72946b88b89ee44c1c527aa8591ac5ffcbe ] The buffer allocated in ti_adpll_clk_get_name doesn't account for the terminating null. This patch switches to devm_kasprintf to avoid overflowing. Signed-off-by: Stephen Kitt Link: https://lkml.kernel.org/r/20191019140634.15596-1-steve@sk2.org Acked-by: Tony Lindgren Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/ti/adpll.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/clk/ti/adpll.c b/drivers/clk/ti/adpll.c index fdfb90058504c..bb2f2836dab22 100644 --- a/drivers/clk/ti/adpll.c +++ b/drivers/clk/ti/adpll.c @@ -194,15 +194,8 @@ static const char *ti_adpll_clk_get_name(struct ti_adpll_data *d, if (err) return NULL; } else { - const char *base_name = "adpll"; - char *buf; - - buf = devm_kzalloc(d->dev, 8 + 1 + strlen(base_name) + 1 + - strlen(postfix), GFP_KERNEL); - if (!buf) - return NULL; - sprintf(buf, "%08lx.%s.%s", d->pa, base_name, postfix); - name = buf; + name = devm_kasprintf(d->dev, GFP_KERNEL, "%08lx.adpll.%s", + d->pa, postfix); } return name; -- 2.25.1