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 BCF9AC18E5A for ; Wed, 11 Mar 2020 09:52:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 950D120848 for ; Wed, 11 Mar 2020 09:52:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728879AbgCKJwO (ORCPT ); Wed, 11 Mar 2020 05:52:14 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:50796 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728146AbgCKJwO (ORCPT ); Wed, 11 Mar 2020 05:52:14 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 4E14F1C031D; Wed, 11 Mar 2020 10:52:12 +0100 (CET) Date: Wed, 11 Mar 2020 10:52:11 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: 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: <20200311095211.GA16104@duo.ucw.cz> References: <20200310124530.808338541@linuxfoundation.org> <20200310124534.139727555@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <20200310124534.139727555@linuxfoundation.org> 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 --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > 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. > --- 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; This may be an improvement, but I believe this should use "scnprintf()" as snprintf can return values bigger than size passed in. Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCXmi0ywAKCRAw5/Bqldv6 8jjvAJ4hb+crf0j89bpBlgTYd7Rqt6RJswCdF2GuMkp+nb7SMMxOhUYI0O71V0s= =CzDo -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd--