From patchwork Mon Aug 17 13:44:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 7025181 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B5819C05AC for ; Mon, 17 Aug 2015 13:45:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D269020690 for ; Mon, 17 Aug 2015 13:45:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7977D2068E for ; Mon, 17 Aug 2015 13:45:46 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 85903261B02; Mon, 17 Aug 2015 15:45:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id AE269260483; Mon, 17 Aug 2015 15:44:34 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C065F260481; Mon, 17 Aug 2015 15:44:32 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id E991926046B for ; Mon, 17 Aug 2015 15:44:25 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B1142ADC2 for ; Mon, 17 Aug 2015 13:44:25 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Mon, 17 Aug 2015 15:44:10 +0200 Message-Id: <1439819051-32166-4-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1439819051-32166-1-git-send-email-tiwai@suse.de> References: <1439819051-32166-1-git-send-email-tiwai@suse.de> Subject: [alsa-devel] [PATCH 3/4] ALSA: hda/proc - Fix racy string access for power states X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The power states in a proc file are printed in a racy manner on a single static string buffer. Fix it by calling snd_iprintf() directly for each state instead of processing on a temporary buffer. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_proc.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 5efcffc32c50..033aa84365b9 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -36,21 +36,6 @@ MODULE_PARM_DESC(dump_coef, "Dump processing coefficients in codec proc file (-1 #define param_read(codec, nid, parm) \ snd_hdac_read_parm_uncached(&(codec)->core, nid, parm) -static char *bits_names(unsigned int bits, const char * const names[], int size) -{ - int i, n; - static char buf[128]; - - for (i = 0, n = 0; i < size; i++) { - if (bits & (1U<