ChangeSet 1.2181.25.47, 2005/03/24 11:56:28+01:00, [EMAIL PROTECTED]

        [ALSA] Fix Oops in snd_emu10k1_add_controls
        
        EMU10K1/EMU10K2 driver
        Fixed Oops in snd_emu101k_add_controls (introduced in the last patch
        for stack usage reduction).
        
        Signed-off-by: Takashi Iwai <[EMAIL PROTECTED]>



 emufx.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


diff -Nru a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
--- a/sound/pci/emu10k1/emufx.c 2005-03-30 16:20:13 -08:00
+++ b/sound/pci/emu10k1/emufx.c 2005-03-30 16:20:13 -08:00
@@ -696,8 +696,8 @@
 {
        unsigned int i, j;
        emu10k1_fx8010_control_gpr_t __user *_gctl;
-       emu10k1_fx8010_control_gpr_t *gctl = NULL;
-       snd_emu10k1_fx8010_ctl_t *ctl, *nctl = NULL;
+       emu10k1_fx8010_control_gpr_t *gctl;
+       snd_emu10k1_fx8010_ctl_t *ctl, *nctl;
        snd_kcontrol_new_t knew;
        snd_kcontrol_t *kctl;
        snd_ctl_elem_value_t *val;
@@ -743,10 +743,12 @@
                nctl->translation = gctl->translation;
                if (ctl == NULL) {
                        ctl = (snd_emu10k1_fx8010_ctl_t *)kmalloc(sizeof(*ctl), 
GFP_KERNEL);
-                       if (ctl == NULL)
-                               continue;
+                       if (ctl == NULL) {
+                               err = -ENOMEM;
+                               goto __error;
+                       }
                        knew.private_value = (unsigned long)ctl;
-                       memcpy(ctl, &nctl, sizeof(nctl));
+                       *ctl = *nctl;
                        if ((err = snd_ctl_add(emu->card, kctl = 
snd_ctl_new1(&knew, emu))) < 0) {
                                kfree(ctl);
                                goto __error;
@@ -758,7 +760,7 @@
                        /* overwrite */
                        nctl->list = ctl->list;
                        nctl->kcontrol = ctl->kcontrol;
-                       memcpy(ctl, &nctl, sizeof(nctl));
+                       *ctl = *nctl;
                        snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE |
                                                  SNDRV_CTL_EVENT_MASK_INFO, 
&ctl->kcontrol->id);
                }
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to