Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932439AbWBTLJL (ORCPT ); Mon, 20 Feb 2006 06:09:11 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932436AbWBTLJL (ORCPT ); Mon, 20 Feb 2006 06:09:11 -0500 Received: from mx1.suse.de ([195.135.220.2]:6109 "EHLO mx1.suse.de") by vger.kernel.org with ESMTP id S932365AbWBTLJJ (ORCPT ); Mon, 20 Feb 2006 06:09:09 -0500 Date: Mon, 20 Feb 2006 12:09:08 +0100 Message-ID: From: Takashi Iwai To: Juergen Kreileder Cc: Alexey Dobriyan , alsa-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [patch] Fix snd-usb-audio in 32-bit compat environemt In-Reply-To: <87hd6vw4t0.fsf@blackdown.de> References: <878xs85wn6.fsf@blackdown.de> <20060219175646.GB7797@mipter.zuzino.mipt.ru> <87hd6vw4t0.fsf@blackdown.de> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta21) (corn) (+CVS-20050720) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1736 Lines: 52 At Sun, 19 Feb 2006 20:02:03 +0100, Juergen Kreileder wrote: > > Alexey Dobriyan writes: > > > On Sat, Feb 18, 2006 at 07:50:37PM +0100, Juergen Kreileder wrote: > >> I'm getting oopses with snd-usb-audio in 32-bit compat > >> environments: control_compat.c:get_ctl_type() doesn't initialize > >> 'info', so > >> 'itemlist[uinfo->value.enumerated.item]' in > >> usbmixer.c:mixer_ctl_selector_info() might access random memory > >> (The 'if ((int)uinfo->value.enumerated.item >= cval->max)' doesn't fix > >> all problems because of the unsigned -> signed conversion.) > > > > IMO, what you did is an overkill. > > The advantage of the longer fix is reduced stack usage. But it also introduces a kmalloc overhead. Let's fix the problem first with a simpler patch. > > Does this patch fixes your problem? > > Yes but you can have that even simpler: > > --- linux-mm-vanilla/sound/core/control_compat.c 2006-02-18 17:00:17.000000000 +0100 > +++ linux-mm/sound/core/control_compat.c 2006-02-19 19:41:51.000000000 +0100 > @@ -167,7 +167,7 @@ static int get_ctl_type(struct snd_card > int *countp) > { > struct snd_kcontrol *kctl; > - struct snd_ctl_elem_info info; > + struct snd_ctl_elem_info info = {0}; > int err; > > down_read(&card->controls_rwsem); I prefer Alexey's patch sicne it's clearer that the zero-initialization is done just before the usage. But = {0} might result in a better code because of compiler optimization... Thanks! Takashi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/