Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3754946pxk; Tue, 29 Sep 2020 05:35:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxwzAKPuBYcJ6yI578liplj/WIbvN52+toaYpdLXqR1xI2BeIEbmMS5185oRAZc6IBNI7J X-Received: by 2002:a17:906:4951:: with SMTP id f17mr3613791ejt.29.1601382936651; Tue, 29 Sep 2020 05:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601382936; cv=none; d=google.com; s=arc-20160816; b=pKCdToZdrMl5Ly1xxOFzUZfLps8lB/c7ACaenAdKF8+pFPcgFOlfPSQKlvA5/4xdO3 eSn8osYlbt5Au/DWc2XRx1pjuOXyjB4czNKxcejn1uQML5/1F6oLqpxfZLqmvJWCoFje iK1dzVjrfbh54irw/AGgbzOvsnUJiNi6z29AwH8aYpXK/TsRjSizPKIOE+4G10N/bdnD qHI7VZfmUqz91Z94ao956ZKsAdjAPuZZ5RGiWEA5AuKz9pnM1wE/Z2QdpIDBmYMQJRDe kIGO/feRm+zvZkVXMNesQzDQf0p+YYX6wrtPGA7Z0+6ZiqYJ2k+oIupP8PgOZUnwad+I QKYA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H7mLGDvs0ZFdAxW8pawZ1q3p3r+D3GT2VJaT4AlZdB0=; b=Mb9cJhBJcLvZ9D5sLaogMOAEukUde0ELkYoeaUisfSDwCYBDw7OgoCU9OCqOmTeLJw P/cUnL0iNJn9rYPqE+LCGFPEloLWbHx6lcdWyrqEqmZqaPGLc7ey1vfeK84Cp2905FeY SRGCXHrzAVRRC/OSB9xs/uelSUTxVgwXZH6+8cM21NmqBDFUFzBessKvO8p1WV2sZveg DgLL/aRGqn9GP26dxFx8Ao2UORZJSv7jyKImd34kqFMBZWaj4vdVe5iFnY3wmhxRtNox zqUp+bFOXvprSfgCDyBJO/DCH1ebYOHQnAv3fLkfjZarz1p2ZCx8cpZCVJlpB4dyqSsA Nf6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M1xWPW9E; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by20si3258337ejc.416.2020.09.29.05.35.13; Tue, 29 Sep 2020 05:35:36 -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=M1xWPW9E; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733010AbgI2McH (ORCPT + 99 others); Tue, 29 Sep 2020 08:32:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:39532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729600AbgI2LXC (ORCPT ); Tue, 29 Sep 2020 07:23:02 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 76B8A221E8; Tue, 29 Sep 2020 11:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378463; bh=rc12dbAf/EcJVbkGg4lUytsW5oyYLwKajNJbdmO3Wpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M1xWPW9EBbFHbsXYwRXue8Ir2csUAGg4fejPD2yV+YiOWKvrkKw8fHkv3N+kY01fM aR5w+9BKb1zLaucpFwjPAv/KLSPkTWtZHup8oH6autpp8m3eqJF91ydzkBFDX3SX4Y vDivAJdT53qN9DsRp7QQNeuILmjRjtC4XB6T3G4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Kitt , Tony Lindgren , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 023/245] clk/ti/adpll: allocate room for terminating null Date: Tue, 29 Sep 2020 12:57:54 +0200 Message-Id: <20200929105948.127161149@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 688e403333b91..14926e07d09ae 100644 --- a/drivers/clk/ti/adpll.c +++ b/drivers/clk/ti/adpll.c @@ -193,15 +193,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