Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3786222ybn; Fri, 27 Sep 2019 11:19:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrq2DjyIvFMA3YyO9tyircKqGsHh/0Gq/dS5AEX4K9GgzoUFLkHOg6lHYA6APHjcaMJNdt X-Received: by 2002:aa7:d48f:: with SMTP id b15mr6108304edr.159.1569608373404; Fri, 27 Sep 2019 11:19:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569608373; cv=none; d=google.com; s=arc-20160816; b=j94y+si5lXnKSYbr2OhGhDuQjplQVmqXLLvodZI5oDBCCV2M/lSb0uos5rTt6W0kEE DWK7VpbLJbf7+FMDPXuRGa+1WvUnC+1vN8QI5PqLUi1QzfUlr3OsSXeT1pBWDvLlVcGc 8JrLxe21oGRGQHtssBDUl4HO42njE7LJAqd+AE+Td56CKsEGfzdEILR0Lt3JT52Kz2db Hxaw/nVJrJqHE5zA7MLRv2BaUzkSqAZUARZtiO1cUtD3WhFhS15GIZoGnrIMjpn1e77Q eVCSGd0j4n+gPAKZ2pGoB0NTtyt6fv8frTseUlDBVpDh44LyEBQ365u7Gyu5N1/TjzxQ ritg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=sEqBHUAC0QZ0dOaPE5frzll2Xq6Sn2khkOh6TA2GPME=; b=OsQ1hZ4tfia6f9SwnksRtwiBd1FEMMkdx8nwsYSDDLOHYznD2Br6iQyEctThmPaRIg gT+z0rqGEkRRnMtf9JMBBJWtbYjEvTz3awG/cQBa13MiRfni14SgUR8IKJc8r3iiATUB pgYcvOYcmGDb/1ovYlJ/SV7htKWSLfiYvdOZOQiPCTVVVmNOK8IqndSdfE1prBlgJibQ IeQNkal+dCbfUkipz269vLzmWo06LActpbyypiFpsjV2UzHSh/7L21qV2XTDh1B2FPoR MZCdw65/L1V50Tifrhe53hxREubnyWaOALZ/wa8b9Cjbl2A35hOxtNDeH/XuY3jHBmUj Q+uQ== ARC-Authentication-Results: i=1; mx.google.com; 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 b25si3342500eja.198.2019.09.27.11.19.06; Fri, 27 Sep 2019 11:19:33 -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; 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 S1727876AbfI0SSs (ORCPT + 99 others); Fri, 27 Sep 2019 14:18:48 -0400 Received: from 2.mo68.mail-out.ovh.net ([46.105.52.162]:47160 "EHLO 2.mo68.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfI0SSs (ORCPT ); Fri, 27 Sep 2019 14:18:48 -0400 X-Greylist: delayed 12603 seconds by postgrey-1.27 at vger.kernel.org; Fri, 27 Sep 2019 14:18:47 EDT Received: from player718.ha.ovh.net (unknown [10.109.160.11]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id 3E4B81423A2 for ; Fri, 27 Sep 2019 20:18:45 +0200 (CEST) Received: from RCM-web9.webmail.mail.ovh.net (unknown [109.190.253.11]) (Authenticated sender: steve@sk2.org) by player718.ha.ovh.net (Postfix) with ESMTPSA id DAB08A401549; Fri, 27 Sep 2019 18:18:37 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Fri, 27 Sep 2019 20:18:37 +0200 From: Stephen Kitt To: Tero Kristo , Michael Turquette , Stephen Boyd , linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, Tony Lindgren Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] clk/ti/adpll: allocate room for terminating null In-Reply-To: <20190927180559.18162-1-steve@sk2.org> References: <20190927180559.18162-1-steve@sk2.org> Message-ID: <8e45c174b787a26eb60762b8ca2e4747@sk2.org> X-Sender: steve@sk2.org User-Agent: Roundcube Webmail/1.3.10 X-Originating-IP: 109.190.253.11 X-Webmail-UserID: steve@sk2.org X-Ovh-Tracer-Id: 5946158883481472455 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrfeeigdduvddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 27/09/2019 20:05, Stephen Kitt a écrit : > The buffer allocated in ti_adpll_clk_get_name doesn't account for the > terminating null. This patch switches to ka_sprintf to avoid Aargh, devm_kasprintf of course... > overflowing. > > Signed-off-by: Stephen Kitt > --- > drivers/clk/ti/adpll.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > 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_adpll_data *d, > 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.%s.%s", > + d->pa, base_name, postfix); > } > > return name;