* Stack usage
@ 2005-03-22 3:34 Lee Revell
2005-03-22 10:22 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Lee Revell @ 2005-03-22 3:34 UTC (permalink / raw)
To: alsa-devel
Andrew Morton made an interesting post on LKML recently and mentioned
that with 4K stacks, 512 bytes is excessive in his opinion.
I ran make checkstack on my 2.6.12-rc1 tree and found some possible ALSA
offenders:
0x0000b186 snd_emu10k1_add_controls: 588
0x0000b3e2 snd_emu10k1_add_controls: 588
0x0536 snd_seq_midisynth_register_port: 564
0x0933 snd_seq_midisynth_register_port: 564
0x00001af3 snd_iprintf: 540
0x00005bd3 snd_verbose_printk: 540
0x0743 snd_virmidi_dev_attach_seq: 464
0x00001c33 snd_mixer_oss_build_input: 464
0x0186 snd_seq_system_client_init: 436
0x0319 snd_seq_system_client_init: 436
0x00003bf6 snd_ctl_card_info: 396
0x00003d30 snd_ctl_card_info: 396
0x00003ef6 snd_pcm_oss_proc_write: 376
0x000042fc snd_pcm_oss_proc_write: 376
0x0000af26 snd_emu10k1_verify_controls: 368
0x0000b085 snd_emu10k1_verify_controls: 368
0x0000b586 snd_emu10k1_list_controls: 316
0x0000b616 snd_emu10k1_list_controls: 316
0x00001c63 snd_pcm_info_user: 308
0x000002e4 snd_pcm_proc_info_read: 300
0x00000431 snd_pcm_proc_info_read: 300
0x00004113 snd_ctl_elem_info_user: 296
0x00000e13 snd_rawmidi_info_user: 288
0x00004c43 snd_ctl_elem_add_user: 288
0x00001ab6 snd_mixer_oss_build_test: 284
0x00001b5a snd_mixer_oss_build_test: 284
0x00000f26 snd_rawmidi_info_select_user: 284
0x00000fb3 snd_rawmidi_info_select_user: 284
0x000026b6 snd_timer_user_ginfo: 268
0x00002882 snd_timer_user_ginfo: 268
It looks like snd_emu10k1_add_controls is not too hard to fix, but maybe
I am missing something.
Any interest in addressing this?
Lee
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Stack usage
2005-03-22 3:34 Stack usage Lee Revell
@ 2005-03-22 10:22 ` Takashi Iwai
2005-03-22 11:27 ` Takashi Iwai
2005-03-22 15:48 ` Takashi Iwai
0 siblings, 2 replies; 6+ messages in thread
From: Takashi Iwai @ 2005-03-22 10:22 UTC (permalink / raw)
To: Lee Revell; +Cc: alsa-devel
At Mon, 21 Mar 2005 22:34:01 -0500,
Lee Revell wrote:
>
> Andrew Morton made an interesting post on LKML recently and mentioned
> that with 4K stacks, 512 bytes is excessive in his opinion.
>
> I ran make checkstack on my 2.6.12-rc1 tree and found some possible ALSA
> offenders:
>
> 0x0000b186 snd_emu10k1_add_controls: 588
> 0x0000b3e2 snd_emu10k1_add_controls: 588
> 0x0536 snd_seq_midisynth_register_port: 564
> 0x0933 snd_seq_midisynth_register_port: 564
> 0x00001af3 snd_iprintf: 540
> 0x00005bd3 snd_verbose_printk: 540
> 0x0743 snd_virmidi_dev_attach_seq: 464
> 0x00001c33 snd_mixer_oss_build_input: 464
> 0x0186 snd_seq_system_client_init: 436
> 0x0319 snd_seq_system_client_init: 436
> 0x00003bf6 snd_ctl_card_info: 396
> 0x00003d30 snd_ctl_card_info: 396
> 0x00003ef6 snd_pcm_oss_proc_write: 376
> 0x000042fc snd_pcm_oss_proc_write: 376
> 0x0000af26 snd_emu10k1_verify_controls: 368
> 0x0000b085 snd_emu10k1_verify_controls: 368
> 0x0000b586 snd_emu10k1_list_controls: 316
> 0x0000b616 snd_emu10k1_list_controls: 316
> 0x00001c63 snd_pcm_info_user: 308
> 0x000002e4 snd_pcm_proc_info_read: 300
> 0x00000431 snd_pcm_proc_info_read: 300
> 0x00004113 snd_ctl_elem_info_user: 296
> 0x00000e13 snd_rawmidi_info_user: 288
> 0x00004c43 snd_ctl_elem_add_user: 288
> 0x00001ab6 snd_mixer_oss_build_test: 284
> 0x00001b5a snd_mixer_oss_build_test: 284
> 0x00000f26 snd_rawmidi_info_select_user: 284
> 0x00000fb3 snd_rawmidi_info_select_user: 284
> 0x000026b6 snd_timer_user_ginfo: 268
> 0x00002882 snd_timer_user_ginfo: 268
>
> It looks like snd_emu10k1_add_controls is not too hard to fix, but maybe
> I am missing something.
It'd be easy - just use kmalloc() for the temporary
emu10k1_fx8010_control_gpr_t instance.
> Any interest in addressing this?
I'll take a look.
Most of the above will be solved easily by the use of kmalloc, I
guess. The above are all initialization or ioctls, so no
time-critical routines.
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Stack usage
2005-03-22 10:22 ` Takashi Iwai
@ 2005-03-22 11:27 ` Takashi Iwai
2005-03-22 11:38 ` Ronny V. Vindenes
2005-03-22 15:48 ` Takashi Iwai
1 sibling, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2005-03-22 11:27 UTC (permalink / raw)
To: Lee Revell; +Cc: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 328 bytes --]
At Tue, 22 Mar 2005 11:22:47 +0100,
I wrote:
>
> > It looks like snd_emu10k1_add_controls is not too hard to fix, but maybe
> > I am missing something.
>
> It'd be easy - just use kmalloc() for the temporary
> emu10k1_fx8010_control_gpr_t instance.
The below is a quick fix for emu10k1 part. Could you give a try?
Takashi
[-- Attachment #2: Type: text/plain, Size: 7321 bytes --]
Index: alsa-kernel/pci/emu10k1/emufx.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-kernel/pci/emu10k1/emufx.c,v
retrieving revision 1.67
diff -u -r1.67 emufx.c
--- alsa-kernel/pci/emu10k1/emufx.c 21 Mar 2005 19:43:42 -0000 1.67
+++ alsa-kernel/pci/emu10k1/emufx.c 22 Mar 2005 11:25:46 -0000
@@ -634,7 +634,8 @@
snd_ctl_elem_id_t __user *_id;
snd_ctl_elem_id_t id;
emu10k1_fx8010_control_gpr_t __user *_gctl;
- emu10k1_fx8010_control_gpr_t gctl;
+ emu10k1_fx8010_control_gpr_t *gctl;
+ int err;
for (i = 0, _id = icode->gpr_del_controls;
i < icode->gpr_del_control_count; i++, _id++) {
@@ -643,28 +644,41 @@
if (snd_emu10k1_look_for_ctl(emu, &id) == NULL)
return -ENOENT;
}
+ gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
+ if (! gctl)
+ return -ENOMEM;
+ err = 0;
for (i = 0, _gctl = icode->gpr_add_controls;
i < icode->gpr_add_control_count; i++, _gctl++) {
- if (copy_from_user(&gctl, _gctl, sizeof(gctl)))
- return -EFAULT;
- if (snd_emu10k1_look_for_ctl(emu, &gctl.id))
+ if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
+ err = -EFAULT;
+ goto __error;
+ }
+ if (snd_emu10k1_look_for_ctl(emu, &gctl->id))
continue;
down_read(&emu->card->controls_rwsem);
- if (snd_ctl_find_id(emu->card, &gctl.id) != NULL) {
+ if (snd_ctl_find_id(emu->card, &gctl->id) != NULL) {
up_read(&emu->card->controls_rwsem);
- return -EEXIST;
+ err = -EEXIST;
+ goto __error;
}
up_read(&emu->card->controls_rwsem);
- if (gctl.id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
- gctl.id.iface != SNDRV_CTL_ELEM_IFACE_PCM)
- return -EINVAL;
+ if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
+ gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) {
+ err = -EINVAL;
+ goto __error;
+ }
}
for (i = 0, _gctl = icode->gpr_list_controls;
i < icode->gpr_list_control_count; i++, _gctl++) {
/* FIXME: we need to check the WRITE access */
- if (copy_from_user(&gctl, _gctl, sizeof(gctl)))
- return -EFAULT;
+ if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
+ err = -EFAULT;
+ goto __error;
+ }
}
+ __error:
+ kfree(gctl);
return 0;
}
@@ -682,46 +696,51 @@
{
unsigned int i, j;
emu10k1_fx8010_control_gpr_t __user *_gctl;
- emu10k1_fx8010_control_gpr_t gctl;
- snd_emu10k1_fx8010_ctl_t *ctl, nctl;
+ emu10k1_fx8010_control_gpr_t *gctl = NULL;
+ snd_emu10k1_fx8010_ctl_t *ctl, *nctl = NULL;
snd_kcontrol_new_t knew;
snd_kcontrol_t *kctl;
snd_ctl_elem_value_t *val;
int err = 0;
val = (snd_ctl_elem_value_t *)kmalloc(sizeof(*val), GFP_KERNEL);
- if (!val)
- return -ENOMEM;
+ gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
+ nctl = kmalloc(sizeof(*nctl), GFP_KERNEL);
+ if (!val || !gctl || !nctl) {
+ err = -ENOMEM;
+ goto __error;
+ }
+
for (i = 0, _gctl = icode->gpr_add_controls;
i < icode->gpr_add_control_count; i++, _gctl++) {
- if (copy_from_user(&gctl, _gctl, sizeof(gctl))) {
+ if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
err = -EFAULT;
goto __error;
}
- snd_runtime_check(gctl.id.iface == SNDRV_CTL_ELEM_IFACE_MIXER ||
- gctl.id.iface == SNDRV_CTL_ELEM_IFACE_PCM, err = -EINVAL; goto __error);
- snd_runtime_check(gctl.id.name[0] != '\0', err = -EINVAL; goto __error);
- ctl = snd_emu10k1_look_for_ctl(emu, &gctl.id);
+ snd_runtime_check(gctl->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER ||
+ gctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM, err = -EINVAL; goto __error);
+ snd_runtime_check(gctl->id.name[0] != '\0', err = -EINVAL; goto __error);
+ ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id);
memset(&knew, 0, sizeof(knew));
- knew.iface = gctl.id.iface;
- knew.name = gctl.id.name;
- knew.index = gctl.id.index;
- knew.device = gctl.id.device;
- knew.subdevice = gctl.id.subdevice;
+ knew.iface = gctl->id.iface;
+ knew.name = gctl->id.name;
+ knew.index = gctl->id.index;
+ knew.device = gctl->id.device;
+ knew.subdevice = gctl->id.subdevice;
knew.info = snd_emu10k1_gpr_ctl_info;
knew.get = snd_emu10k1_gpr_ctl_get;
knew.put = snd_emu10k1_gpr_ctl_put;
- memset(&nctl, 0, sizeof(nctl));
- nctl.vcount = gctl.vcount;
- nctl.count = gctl.count;
+ memset(nctl, 0, sizeof(*nctl));
+ nctl->vcount = gctl->vcount;
+ nctl->count = gctl->count;
for (j = 0; j < 32; j++) {
- nctl.gpr[j] = gctl.gpr[j];
- nctl.value[j] = ~gctl.value[j]; /* inverted, we want to write new value in gpr_ctl_put() */
- val->value.integer.value[j] = gctl.value[j];
- }
- nctl.min = gctl.min;
- nctl.max = gctl.max;
- nctl.translation = gctl.translation;
+ nctl->gpr[j] = gctl->gpr[j];
+ nctl->value[j] = ~gctl->value[j]; /* inverted, we want to write new value in gpr_ctl_put() */
+ val->value.integer.value[j] = gctl->value[j];
+ }
+ nctl->min = gctl->min;
+ nctl->max = gctl->max;
+ nctl->translation = gctl->translation;
if (ctl == NULL) {
ctl = (snd_emu10k1_fx8010_ctl_t *)kmalloc(sizeof(*ctl), GFP_KERNEL);
if (ctl == NULL)
@@ -737,8 +756,8 @@
list_add_tail(&ctl->list, &emu->fx8010.gpr_ctl);
} else {
/* overwrite */
- nctl.list = ctl->list;
- nctl.kcontrol = ctl->kcontrol;
+ nctl->list = ctl->list;
+ nctl->kcontrol = ctl->kcontrol;
memcpy(ctl, &nctl, sizeof(nctl));
snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE |
SNDRV_CTL_EVENT_MASK_INFO, &ctl->kcontrol->id);
@@ -746,6 +765,8 @@
snd_emu10k1_gpr_ctl_put(ctl->kcontrol, val);
}
__error:
+ kfree(nctl);
+ kfree(gctl);
kfree(val);
return err;
}
@@ -774,40 +795,47 @@
{
unsigned int i = 0, j;
unsigned int total = 0;
- emu10k1_fx8010_control_gpr_t gctl;
+ emu10k1_fx8010_control_gpr_t *gctl;
emu10k1_fx8010_control_gpr_t __user *_gctl;
snd_emu10k1_fx8010_ctl_t *ctl;
snd_ctl_elem_id_t *id;
struct list_head *list;
+ gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
+ if (! gctl)
+ return -ENOMEM;
+
_gctl = icode->gpr_list_controls;
list_for_each(list, &emu->fx8010.gpr_ctl) {
ctl = emu10k1_gpr_ctl(list);
total++;
if (_gctl && i < icode->gpr_list_control_count) {
- memset(&gctl, 0, sizeof(gctl));
+ memset(gctl, 0, sizeof(*gctl));
id = &ctl->kcontrol->id;
- gctl.id.iface = id->iface;
- strlcpy(gctl.id.name, id->name, sizeof(gctl.id.name));
- gctl.id.index = id->index;
- gctl.id.device = id->device;
- gctl.id.subdevice = id->subdevice;
- gctl.vcount = ctl->vcount;
- gctl.count = ctl->count;
+ gctl->id.iface = id->iface;
+ strlcpy(gctl->id.name, id->name, sizeof(gctl->id.name));
+ gctl->id.index = id->index;
+ gctl->id.device = id->device;
+ gctl->id.subdevice = id->subdevice;
+ gctl->vcount = ctl->vcount;
+ gctl->count = ctl->count;
for (j = 0; j < 32; j++) {
- gctl.gpr[j] = ctl->gpr[j];
- gctl.value[j] = ctl->value[j];
+ gctl->gpr[j] = ctl->gpr[j];
+ gctl->value[j] = ctl->value[j];
}
- gctl.min = ctl->min;
- gctl.max = ctl->max;
- gctl.translation = ctl->translation;
- if (copy_to_user(_gctl, &gctl, sizeof(gctl)))
+ gctl->min = ctl->min;
+ gctl->max = ctl->max;
+ gctl->translation = ctl->translation;
+ if (copy_to_user(_gctl, gctl, sizeof(*gctl))) {
+ kfree(gctl);
return -EFAULT;
+ }
_gctl++;
i++;
}
}
icode->gpr_list_control_total = total;
+ kfree(gctl);
return 0;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Stack usage
2005-03-22 11:27 ` Takashi Iwai
@ 2005-03-22 11:38 ` Ronny V. Vindenes
2005-03-22 11:43 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Ronny V. Vindenes @ 2005-03-22 11:38 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Lee Revell, alsa-devel
tir, 22,.03.2005 kl. 12.27 +0100, skrev Takashi Iwai:
> At Tue, 22 Mar 2005 11:22:47 +0100,
> I wrote:
> >
> > > It looks like snd_emu10k1_add_controls is not too hard to fix, but maybe
> > > I am missing something.
> >
> > It'd be easy - just use kmalloc() for the temporary
> > emu10k1_fx8010_control_gpr_t instance.
>
> The below is a quick fix for emu10k1 part. Could you give a try?
>
>
> Takashi
> Index: alsa-kernel/pci/emu10k1/emufx.c
> ===================================================================
> RCS file: /home/iwai/cvs/alsa/alsa-kernel/pci/emu10k1/emufx.c,v
> retrieving revision 1.67
> diff -u -r1.67 emufx.c
> --- alsa-kernel/pci/emu10k1/emufx.c 21 Mar 2005 19:43:42 -0000 1.67
> +++ alsa-kernel/pci/emu10k1/emufx.c 22 Mar 2005 11:25:46 -0000
> @@ -634,7 +634,8 @@
> snd_ctl_elem_id_t __user *_id;
> snd_ctl_elem_id_t id;
> emu10k1_fx8010_control_gpr_t __user *_gctl;
> - emu10k1_fx8010_control_gpr_t gctl;
> + emu10k1_fx8010_control_gpr_t *gctl;
> + int err;
>
> for (i = 0, _id = icode->gpr_del_controls;
> i < icode->gpr_del_control_count; i++, _id++) {
> @@ -643,28 +644,41 @@
> if (snd_emu10k1_look_for_ctl(emu, &id) == NULL)
> return -ENOENT;
> }
> + gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
> + if (! gctl)
> + return -ENOMEM;
> + err = 0;
> for (i = 0, _gctl = icode->gpr_add_controls;
> i < icode->gpr_add_control_count; i++, _gctl++) {
> - if (copy_from_user(&gctl, _gctl, sizeof(gctl)))
> - return -EFAULT;
> - if (snd_emu10k1_look_for_ctl(emu, &gctl.id))
> + if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
> + err = -EFAULT;
> + goto __error;
> + }
> + if (snd_emu10k1_look_for_ctl(emu, &gctl->id))
> continue;
> down_read(&emu->card->controls_rwsem);
> - if (snd_ctl_find_id(emu->card, &gctl.id) != NULL) {
> + if (snd_ctl_find_id(emu->card, &gctl->id) != NULL) {
> up_read(&emu->card->controls_rwsem);
> - return -EEXIST;
> + err = -EEXIST;
> + goto __error;
> }
> up_read(&emu->card->controls_rwsem);
> - if (gctl.id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
> - gctl.id.iface != SNDRV_CTL_ELEM_IFACE_PCM)
> - return -EINVAL;
> + if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
> + gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) {
> + err = -EINVAL;
> + goto __error;
> + }
> }
> for (i = 0, _gctl = icode->gpr_list_controls;
> i < icode->gpr_list_control_count; i++, _gctl++) {
> /* FIXME: we need to check the WRITE access */
> - if (copy_from_user(&gctl, _gctl, sizeof(gctl)))
> - return -EFAULT;
> + if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
> + err = -EFAULT;
> + goto __error;
> + }
> }
> + __error:
> + kfree(gctl);
> return 0;
This should be return err; right?
--
Ronny V. Vindenes <s864@ii.uib.no>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Stack usage
2005-03-22 11:38 ` Ronny V. Vindenes
@ 2005-03-22 11:43 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2005-03-22 11:43 UTC (permalink / raw)
To: Ronny V. Vindenes; +Cc: Lee Revell, alsa-devel
At Tue, 22 Mar 2005 12:38:17 +0100,
Ronny V. Vindenes wrote:
>
> tir, 22,.03.2005 kl. 12.27 +0100, skrev Takashi Iwai:
> > At Tue, 22 Mar 2005 11:22:47 +0100,
> > I wrote:
> > >
> > > > It looks like snd_emu10k1_add_controls is not too hard to fix, but maybe
> > > > I am missing something.
> > >
> > > It'd be easy - just use kmalloc() for the temporary
> > > emu10k1_fx8010_control_gpr_t instance.
> >
> > The below is a quick fix for emu10k1 part. Could you give a try?
> >
> >
> > Takashi
> > Index: alsa-kernel/pci/emu10k1/emufx.c
> > ===================================================================
> > RCS file: /home/iwai/cvs/alsa/alsa-kernel/pci/emu10k1/emufx.c,v
> > retrieving revision 1.67
> > diff -u -r1.67 emufx.c
> > --- alsa-kernel/pci/emu10k1/emufx.c 21 Mar 2005 19:43:42 -0000 1.67
> > +++ alsa-kernel/pci/emu10k1/emufx.c 22 Mar 2005 11:25:46 -0000
> > @@ -634,7 +634,8 @@
> > snd_ctl_elem_id_t __user *_id;
> > snd_ctl_elem_id_t id;
> > emu10k1_fx8010_control_gpr_t __user *_gctl;
> > - emu10k1_fx8010_control_gpr_t gctl;
> > + emu10k1_fx8010_control_gpr_t *gctl;
> > + int err;
> >
> > for (i = 0, _id = icode->gpr_del_controls;
> > i < icode->gpr_del_control_count; i++, _id++) {
> > @@ -643,28 +644,41 @@
> > if (snd_emu10k1_look_for_ctl(emu, &id) == NULL)
> > return -ENOENT;
> > }
> > + gctl = kmalloc(sizeof(*gctl), GFP_KERNEL);
> > + if (! gctl)
> > + return -ENOMEM;
> > + err = 0;
> > for (i = 0, _gctl = icode->gpr_add_controls;
> > i < icode->gpr_add_control_count; i++, _gctl++) {
> > - if (copy_from_user(&gctl, _gctl, sizeof(gctl)))
> > - return -EFAULT;
> > - if (snd_emu10k1_look_for_ctl(emu, &gctl.id))
> > + if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
> > + err = -EFAULT;
> > + goto __error;
> > + }
> > + if (snd_emu10k1_look_for_ctl(emu, &gctl->id))
> > continue;
> > down_read(&emu->card->controls_rwsem);
> > - if (snd_ctl_find_id(emu->card, &gctl.id) != NULL) {
> > + if (snd_ctl_find_id(emu->card, &gctl->id) != NULL) {
> > up_read(&emu->card->controls_rwsem);
> > - return -EEXIST;
> > + err = -EEXIST;
> > + goto __error;
> > }
> > up_read(&emu->card->controls_rwsem);
> > - if (gctl.id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
> > - gctl.id.iface != SNDRV_CTL_ELEM_IFACE_PCM)
> > - return -EINVAL;
> > + if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
> > + gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) {
> > + err = -EINVAL;
> > + goto __error;
> > + }
> > }
> > for (i = 0, _gctl = icode->gpr_list_controls;
> > i < icode->gpr_list_control_count; i++, _gctl++) {
> > /* FIXME: we need to check the WRITE access */
> > - if (copy_from_user(&gctl, _gctl, sizeof(gctl)))
> > - return -EFAULT;
> > + if (copy_from_user(gctl, _gctl, sizeof(*gctl))) {
> > + err = -EFAULT;
> > + goto __error;
> > + }
> > }
> > + __error:
> > + kfree(gctl);
> > return 0;
>
> This should be return err; right?
Yep, thanks.
Takashi
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Stack usage
2005-03-22 10:22 ` Takashi Iwai
2005-03-22 11:27 ` Takashi Iwai
@ 2005-03-22 15:48 ` Takashi Iwai
1 sibling, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2005-03-22 15:48 UTC (permalink / raw)
To: Lee Revell; +Cc: alsa-devel
At Tue, 22 Mar 2005 11:22:47 +0100,
I wrote:
>
> I'll take a look.
>
> Most of the above will be solved easily by the use of kmalloc, I
> guess. The above are all initialization or ioctls, so no
> time-critical routines.
Most of them are fixed now on CVS.
Still the following take more than 256 bytes:
0x00006f3b cs46xx_dsp_async_init: 296
0x0000734e cs46xx_dsp_async_init: 296
0x00007390 cs46xx_dsp_async_init: 296
0x00000af0 mixart_set_format: 292
0x00000ba1 mixart_set_format: 292
0x000014a4 snd_trident_synth_new_device: 288
0x0000160e snd_trident_synth_new_device: 288
0x00000f30 snd_rawmidi_info_select_user: 288
0x00000fd2 snd_rawmidi_info_select_user: 288
0x00004780 snd_ctl_elem_info_user: 284
0x000047f3 snd_ctl_elem_info_user: 284
0x00005160 snd_ctl_elem_add_user: 284
0x000051b8 snd_ctl_elem_add_user: 284
0x00000e40 snd_rawmidi_info_user: 280
0x00000e87 snd_rawmidi_info_user: 280
0x000035d6 snd_gus_dram_poke: 268
0x00003675 snd_gus_dram_poke: 268
0x000036f6 snd_gus_dram_peek: 268
0x0000381f snd_gus_dram_peek: 268
0x0189 snd_opl4_seq_new_device: 268
0x02ce snd_opl4_seq_new_device: 268
0x02ec snd_opl4_seq_new_device: 268
0x0000 create_port: 260
0x014a create_port: 260
cs46xx_dsp_async_init is a bit nasty because this is the non-static
struct initialization...
Takashi
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-03-22 15:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22 3:34 Stack usage Lee Revell
2005-03-22 10:22 ` Takashi Iwai
2005-03-22 11:27 ` Takashi Iwai
2005-03-22 11:38 ` Ronny V. Vindenes
2005-03-22 11:43 ` Takashi Iwai
2005-03-22 15:48 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.