[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200311095329.GA16792@duo.ucw.cz>
Date: Wed, 11 Mar 2020 10:53:29 +0100
From: Pavel Machek <pavel@...x.de>
To: Pavel Machek <pavel@...x.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Takashi Iwai <tiwai@...e.de>,
Cezary Rojewski <cezary.rojewski@...el.com>,
Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH 4.19 62/86] ASoC: intel: skl: Fix pin debug prints
On Wed 2020-03-11 10:52:11, Pavel Machek wrote:
> Hi!
>
> > From: Takashi Iwai <tiwai@...e.de>
> >
> > commit 64bbacc5f08c01954890981c63de744df1f29a30 upstream.
> >
> > 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 = 0;
> >
> > - for (i = 0; i < max_pin; i++)
> > + for (i = 0; i < max_pin; i++) {
> > ret += 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 += 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.
Aha, and it indeed does that, just in the separate patch.
Sorry for the noise,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists