Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1197430ybg; Fri, 18 Oct 2019 13:38:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzj5aqR1IJ57wps8Te9HrobAe/zDDCPfj/00/umqGUzHS81HZE637AJ0CFixra8Kz7wJ64z X-Received: by 2002:a17:906:4757:: with SMTP id j23mr10121014ejs.174.1571431093749; Fri, 18 Oct 2019 13:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571431093; cv=none; d=google.com; s=arc-20160816; b=YHTGpyrtj3EC39uJs/UGfK5/t2QWI8mxjWoZzxzu9Vd3awrku4f44hTkmBtHlrTbKn fhyB9EjlQruBBhVbuQV0yX+s6BBthUXyGe8i+MmLB4OAs7n+Rt9TQD5uWgvf4HGYedwO pcVNl0tGXpbcmvxs2o+wb+uIFi81pJnmsrLpUx5lghbaI/3MKoLT2gaoc/ZKCezoMYDZ cg4JEn2Nfdorxt7O5tY5tzw8QRc5B+2wB6Ue4hmFH6d6Gaf9uzAgHJ+8sS5IWvrworQx rWI+wxSbbJ8j6JMkrgreTuBT2VetF49NENyaIMLh+VxaUWoNnmCqSfmjY6iEp7ovikXR Ortw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:subject:cc:to :from:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=UqI6iTY2ysLSInjxuFmporN7/FFXlrzHfTM3jMoCBRg=; b=XdigWj19darEmel82EwLa0aV7urI1o5pNlVzUCXMlfIsfbKbLcE8qinNlTiiE/hZQG +LsSCBKD8lKtZ60Pzz2gd2q09Jt9Ci359Q2icthYldILfX8NDdncR8S0TMefWeFpsOLg Vi9MuOgryF+J1EpDqzP7yZWEqav0vY5nOj8q+I11LulPhbYlDoeePXBP7gpVLmwxf+7g deyhGf7oqSocoqZWcTqQLhz5xvC0dDbBAtK9CdEgc24mqsk8NCPSN2PAWf7mtkh3BZoa akIqmxJ89l5/LiTiwc7jA+74p8mOGaF3nHnf+XVoPcCgpr8qi/z4VHm2QzSc3hRjyNFD j4YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nr4BhFNo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si4117220eja.226.2019.10.18.13.37.51; Fri, 18 Oct 2019 13:38:13 -0700 (PDT) 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=Nr4BhFNo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393688AbfJQPsz (ORCPT + 99 others); Thu, 17 Oct 2019 11:48:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:43218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731907AbfJQPsz (ORCPT ); Thu, 17 Oct 2019 11:48:55 -0400 Received: from kernel.org (unknown [104.132.0.74]) (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 5285220869; Thu, 17 Oct 2019 15:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571327334; bh=x7ytOe7ngBLCL0IqMlx2YLDHSN6K+mWYaq3Lc/ow294=; h=In-Reply-To:References:From:To:Cc:Subject:Date:From; b=Nr4BhFNoD1XZmbL1oepItE12NliaqynEWLLXlpirP3jvRsafIo0i9jUmR7Bts5Y0G XGFL/8h+EQmrZMy1ciFaf08sozYqP2rZisAfq82f1iJBCviEfaRAc8ZZnQ3Dvaj+AZ r3q/Mc3oA3o7mGOIroONkF3Br3S+loJlElpMbVy0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190927180559.18162-1-steve@sk2.org> References: <20190927180559.18162-1-steve@sk2.org> From: Stephen Boyd To: Michael Turquette , Stephen Kitt , Tero Kristo , Tony Lindgren , linux-clk@vger.kernel.org, linux-omap@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Stephen Kitt Subject: Re: [PATCH v2] clk/ti/adpll: allocate room for terminating null User-Agent: alot/0.8.1 Date: Thu, 17 Oct 2019 08:48:53 -0700 Message-Id: <20191017154854.5285220869@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Stephen Kitt (2019-09-27 11:05:59) > The buffer allocated in ti_adpll_clk_get_name doesn't account for the > terminating null. This patch switches to ka_sprintf to avoid > overflowing. >=20 > Signed-off-by: Stephen Kitt > --- > drivers/clk/ti/adpll.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/clk/ti/adpll.c b/drivers/clk/ti/adpll.c > index fdfb90058504..021cf9e2b4db 100644 > --- a/drivers/clk/ti/adpll.c > +++ b/drivers/clk/ti/adpll.c > @@ -195,14 +195,8 @@ static const char *ti_adpll_clk_get_name(struct ti_a= dpll_data *d, > return NULL; > } else { > const char *base_name =3D "adpll"; This is used once. > - char *buf; > - > - buf =3D 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 =3D buf; > + name =3D devm_kasprintf(d->dev, GFP_KERNEL, "%08lx.%s.%s", So why not make this "%08lx.adpll.%s"? > + d->pa, base_name, postfix); > }