From patchwork Thu Jan 23 07:49:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Volker_R=C3=BCmelin?= X-Patchwork-Id: 1227687 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=t-online.de Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 483F3R59jGz9sSL for ; Thu, 23 Jan 2020 18:56:51 +1100 (AEDT) Received: from localhost ([::1]:52448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuXM9-0005d0-3P for incoming@patchwork.ozlabs.org; Thu, 23 Jan 2020 02:56:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46175) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuXFd-00061d-R3 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:50:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iuXFc-0004j0-UB for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:50:05 -0500 Received: from mailout03.t-online.de ([194.25.134.81]:50686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iuXFc-0004hu-OE for qemu-devel@nongnu.org; Thu, 23 Jan 2020 02:50:04 -0500 Received: from fwd06.aul.t-online.de (fwd06.aul.t-online.de [172.20.26.150]) by mailout03.t-online.de (Postfix) with SMTP id CAC18426D4ED; Thu, 23 Jan 2020 08:50:02 +0100 (CET) Received: from linpower.localnet (bdOpmsZawhWbFhK9XojQt-0+cJTgGNpHSj4-Vdy8o65QU2oaeQz3Suo1r9mdc4wwHq@[46.86.62.122]) by fwd06.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1iuXFU-12fW7M0; Thu, 23 Jan 2020 08:49:56 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 5CBB8200F75; Thu, 23 Jan 2020 08:49:43 +0100 (CET) From: =?utf-8?q?Volker_R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 6/9] ossaudio: prevent SIGSEGV in oss_enable_out Date: Thu, 23 Jan 2020 08:49:40 +0100 Message-Id: <20200123074943.6699-6-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <1e29e1d3-b59b-fcd6-cdff-a680bcdbffa4@t-online.de> References: <1e29e1d3-b59b-fcd6-cdff-a680bcdbffa4@t-online.de> MIME-Version: 1.0 X-ID: bdOpmsZawhWbFhK9XojQt-0+cJTgGNpHSj4-Vdy8o65QU2oaeQz3Suo1r9mdc4wwHq X-TOI-MSGID: ca8aec17-591c-475c-b00f-b6ac2ae58548 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 194.25.134.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU , =?utf-8?b?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" With audiodev parameter out.mixing-engine=off hw->mix_buf is NULL. This patch reverts a small part of dc88e38fa7 "audio: unify input and output mixeng buffer management". To reproduce the problem start qemu with -audiodev oss,id=audio0,try-mmap=on,out.mixing-engine=off Signed-off-by: Volker RĂ¼melin --- audio/ossaudio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index 4965084a5a..6a3b78b381 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -592,7 +592,7 @@ static void oss_enable_out(HWVoiceOut *hw, bool enable) return; } - audio_pcm_info_clear_buf(&hw->info, hw->buf_emul, hw->mix_buf->size); + audio_pcm_info_clear_buf(&hw->info, hw->buf_emul, hw->samples); trig = PCM_ENABLE_OUTPUT; if (ioctl(oss->fd, SNDCTL_DSP_SETTRIGGER, &trig) < 0) { oss_logerr(errno,