From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5720C3F2C6 for ; Wed, 11 Mar 2020 09:53:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8BDF820848 for ; Wed, 11 Mar 2020 09:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728907AbgCKJxb (ORCPT ); Wed, 11 Mar 2020 05:53:31 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:51054 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726160AbgCKJxb (ORCPT ); Wed, 11 Mar 2020 05:53:31 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 8F48D1C031D; Wed, 11 Mar 2020 10:53:29 +0100 (CET) Date: Wed, 11 Mar 2020 10:53:29 +0100 From: Pavel Machek To: Pavel Machek Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Takashi Iwai , Cezary Rojewski , Mark Brown Subject: Re: [PATCH 4.19 62/86] ASoC: intel: skl: Fix pin debug prints Message-ID: <20200311095329.GA16792@duo.ucw.cz> References: <20200310124530.808338541@linuxfoundation.org> <20200310124534.139727555@linuxfoundation.org> <20200311095211.GA16104@duo.ucw.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: <20200311095211.GA16104@duo.ucw.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed 2020-03-11 10:52:11, Pavel Machek wrote: > Hi! >=20 > > From: Takashi Iwai > >=20 > > commit 64bbacc5f08c01954890981c63de744df1f29a30 upstream. > >=20 > > skl_print_pins() loops over all given pins but it overwrites the text > > at the very same position while increasing the returned length. > > Fix this to show the all pin contents properly. >=20 > > --- a/sound/soc/intel/skylake/skl-debug.c > > +++ b/sound/soc/intel/skylake/skl-debug.c > > @@ -42,7 +42,7 @@ static ssize_t skl_print_pins(struct skl > > int i; > > ssize_t ret =3D 0; > > =20 > > - for (i =3D 0; i < max_pin; i++) > > + for (i =3D 0; i < max_pin; i++) { > > ret +=3D snprintf(buf + size, MOD_BUF - size, > > "%s %d\n\tModule %d\n\tInstance %d\n\t" > > "In-used %s\n\tType %s\n" > > @@ -53,6 +53,8 @@ static ssize_t skl_print_pins(struct skl > > m_pin[i].in_use ? "Used" : "Unused", > > m_pin[i].is_dynamic ? "Dynamic" : "Static", > > m_pin[i].pin_state, i); > > + size +=3D ret; > > + } > > return ret; >=20 > This may be an improvement, but I believe this should use > "scnprintf()" as snprintf can return values bigger than size passed > in. Aha, and it indeed does that, just in the separate patch. Sorry for the noise, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --DocE+STaALJfprDB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCXmi1GQAKCRAw5/Bqldv6 8kYvAJ9yU3awlq1MOAbq/2B9bV7U6MJyxwCcDdgqwsDq4hSYeG8DCehrs4A8woY= =mWga -----END PGP SIGNATURE----- --DocE+STaALJfprDB--