From: Takashi Iwai Subject: Re: [PATCH] dapm_new_mixer and 32 bytes limitation Date: Mon, 21 Jan 2008 11:54:19 +0100 Message-ID: References: <87r6geevtb.fsf@polgara.paysbobval> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 5D72E2442A for ; Mon, 21 Jan 2008 11:54:19 +0100 (CET) In-Reply-To: <87r6geevtb.fsf@polgara.paysbobval> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Robert Jarzmik Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At 18 Jan 2008 21:13:36 +0100, Robert Jarzmik wrote: > > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c > index ea20138..f22a1bb 100644 > --- a/sound/soc/soc-dapm.c > +++ b/sound/soc/soc-dapm.c > @@ -281,7 +281,7 @@ static int dapm_new_mixer(struct snd_soc_codec *codec, > struct snd_soc_dapm_widget *w) > { > int i, ret = 0; > - char name[32]; > + char name[44]; Let's add a global const in asound.h instead of using a magic number everywhere. > struct snd_soc_dapm_path *path; > > /* add kcontrol */ > @@ -295,7 +295,8 @@ static int dapm_new_mixer(struct snd_soc_codec *codec, > continue; > > /* add dapm control with long name */ > - snprintf(name, 32, "%s %s", w->name, w->kcontrols[i].name); > + snprintf(name, 43, "%s %s", w->name, w->kcontrols[i].name); > + name[43] = 0; snprintf() terminates the string. The usual call is snprintf(name, sizeof(name), ...); Thanks, Takashi