From patchwork Thu Mar 8 07:40:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10267125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C9A160364 for ; Thu, 8 Mar 2018 07:40:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F045297DE for ; Thu, 8 Mar 2018 07:40:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41739297E0; Thu, 8 Mar 2018 07:40:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2744297DE for ; Thu, 8 Mar 2018 07:40:56 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DD715267412; Thu, 8 Mar 2018 08:40:54 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B0A79267466; Thu, 8 Mar 2018 08:40:52 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 3363C267403 for ; Thu, 8 Mar 2018 08:40:49 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8DDFDAE19 for ; Thu, 8 Mar 2018 07:40:49 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Thu, 8 Mar 2018 08:40:40 +0100 Message-Id: <20180308074040.16151-2-tiwai@suse.de> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180308074040.16151-1-tiwai@suse.de> References: <20180308074040.16151-1-tiwai@suse.de> Subject: [alsa-devel] [PATCH 2/2] ALSA: vmaster: Zero-clear ctl before calling slave get X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use kzalloc() instead of kmalloc() so that we don't need to rely fully on the slave get() callback to clear the control value that might be copied to user-space. Signed-off-by: Takashi Iwai --- sound/core/vmaster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index b67de2bb06a2..9e96186742d0 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -63,7 +63,7 @@ static int slave_update(struct link_slave *slave) struct snd_ctl_elem_value *uctl; int err, ch; - uctl = kmalloc(sizeof(*uctl), GFP_KERNEL); + uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); if (!uctl) return -ENOMEM; uctl->id = slave->slave.id;