[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200311095211.GA16104@duo.ucw.cz>
Date: Wed, 11 Mar 2020 10:52:11 +0100
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: 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
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.
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists