Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3745014pxk; Tue, 29 Sep 2020 05:20:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYQYv34eRMtZ5Fsjlk3C+fv8Eum7y6sbSovc09wy5Vy2MwvrXnc09APtoT/fxsurbv66VT X-Received: by 2002:a17:906:fa0a:: with SMTP id lo10mr1357358ejb.22.1601382055235; Tue, 29 Sep 2020 05:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601382055; cv=none; d=google.com; s=arc-20160816; b=DWliWhNB0RBM4gC3hewLjSJCfCpdISDI/L5FIXJfTCiEyHpJNUg9yM/QK0bOggQ3qp VDz7/U9ka4gxIne6Vrd/+crEVQFwq12EQI51XIimUvGG76/tLUhSzlN0/cFPh3s8f6cE hl0dXPh+8JUPQsLbnBOsV+pbvs6P6f38hqW9UMfh//mVfFHmh6lm2SCD7+EVZtTwwGUI CSYY1XXoa41wyTaMBhZMpRZCX9a2G6Q0y2jq8poVI1c1BdegDi5XgXQZEjrfVGk7Gwu2 BT1D7eINufL3vOzXtzFdVjxZ+oWI5KZfsQMM3+PniNOGKzlXrliRxNq6Fgq8mR3ivM4w HUbw== 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=AQUKWzW6aLn4R5BuZIjOQZ13Xr/rPZ6WIeZToyA7Vg8=; b=DgxRnMBZaguRfMfXUcmRNhWP9Oz+3KVyVyLPOYfpIwmQdHVkhkojI7hOopZR0P85tE ykgXFXQHoP8l+JaZsav8GhwJYII0ZxGIce9HxzDiT0tzJvts5aT5emdvAl7VDpL68sPj S7xq/J22xdOch6CBmNmt9KJDYTdvwF9S7p69GpWH87I/0wXOjqQhkhrVac7ratt6s4yH zWECiRatSTEsn3KBg2uyGbTzlIuqI1gNONfFp2DTChvhcgiaPQr0D+EyRf8WvYpFKRqV bY6RSRXWDyw2t2h8LYgw8z8F+t0JJw1uFGtGVDtb7XShUq2PszqFuztpq2bqMRaZEg/f 1/pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Tpr0sVtO; 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 i7si1841781ejo.472.2020.09.29.05.20.32; Tue, 29 Sep 2020 05:20:55 -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=Tpr0sVtO; 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 S1730587AbgI2MRY (ORCPT + 99 others); Tue, 29 Sep 2020 08:17:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:49220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730030AbgI2Lg7 (ORCPT ); Tue, 29 Sep 2020 07:36:59 -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 8789B23AC6; Tue, 29 Sep 2020 11:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379144; bh=TbwRRcbFWiuMB8dfF8YlJolXDH48+LAChbI07sEfkpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tpr0sVtO+izi8lujrF/25PjuL5El0wXcpwTGPTWe8h1+oGMd9iHCRbfoMq1ShaUF0 MYLjC4MVxB113y+ecl3WZs86XYu8p69rIJq4kpeTlU6O5hwZr1cTyy+PQJLwn2ZCKR IwGgT1pS2k5wT3DMoUusY4Kmv41s/96aOGd4aClA= 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 5.4 033/388] clk/ti/adpll: allocate room for terminating null Date: Tue, 29 Sep 2020 12:56:04 +0200 Message-Id: <20200929110012.095517293@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@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 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