ALSA: compress: Use kzalloc() for ioctls writing back data
authorTakashi Iwai <tiwai@suse.de>
Mon, 22 Apr 2013 08:38:26 +0000 (10:38 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 22 Apr 2013 08:40:29 +0000 (10:40 +0200)
Like the previous patch by Dan, we should clear the data to be
returned from certain compress ioctls, namely,
snd_compr_get_codec_caps() and snd_compr_get_params().
This time, we can simply replace kmalloc() with kzalloc().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/compress_offload.c

index 664c69398b4168441cbbe5fbcf0f9352f9b3b083..a0bc47f8dcf7f3c2502b686983fcfc494c295287 100644 (file)
@@ -428,7 +428,7 @@ snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg)
        if (!stream->ops->get_codec_caps)
                return -ENXIO;
 
-       caps = kmalloc(sizeof(*caps), GFP_KERNEL);
+       caps = kzalloc(sizeof(*caps), GFP_KERNEL);
        if (!caps)
                return -ENOMEM;
 
@@ -545,7 +545,7 @@ snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg)
        if (!stream->ops->get_params)
                return -EBADFD;
 
-       params = kmalloc(sizeof(*params), GFP_KERNEL);
+       params = kzalloc(sizeof(*params), GFP_KERNEL);
        if (!params)
                return -ENOMEM;
        retval = stream->ops->get_params(stream, params);