From nobody Tue Feb 10 13:17:04 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1600622389; cv=none; d=zohomail.com; s=zohoarc; b=TUIAwV4OPKO23DLLS2w7f7cEfu4kfxDBXAcvrNEEt4WB+ElaLpHsRMuwmKp3GoqpgPPv3EFkYAQf2XD5CHyxRJQI2I98JnikaJnanQlOd3WhXK4zzWguLfvp0TmodfaoNypiy6yAwDeWwFi+0AA6cFCTkM231eH2hLNVV7ZuK6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600622389; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d/SFRzAtteMQtfcDXtvgpwJbaOEdcvpzD+BcFaJ2xpg=; b=W+gxdBLhg/QVAuBiFomEJIuRockT1A1d9T7atybWYpnFcDWKg6l+dbtmWVEbq1LFBqEhO2p8M4Qfc9ndj6MsOYjA9Yzwq1GrsYYnoqExDWRHL2efh79mWEOb4VXla9/iixhbZuVntt465+XtMBiaZXFmOV51485SJwbGzVuUbjY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160062238917180.86871916453572; Sun, 20 Sep 2020 10:19:49 -0700 (PDT) Received: from localhost ([::1]:47592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kK307-0005Zt-Pu for importer@patchew.org; Sun, 20 Sep 2020 13:19:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kK2xz-000404-Qx for qemu-devel@nongnu.org; Sun, 20 Sep 2020 13:17:35 -0400 Received: from mailout11.t-online.de ([194.25.134.85]:50884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kK2xy-0006FR-2G for qemu-devel@nongnu.org; Sun, 20 Sep 2020 13:17:35 -0400 Received: from fwd13.aul.t-online.de (fwd13.aul.t-online.de [172.20.27.62]) by mailout11.t-online.de (Postfix) with SMTP id 40457425E999; Sun, 20 Sep 2020 19:17:31 +0200 (CEST) Received: from linpower.localnet (JbTBTgZ1wh5e1YUvG8omkAi00eJ6ksRPSWkzSvHvuJpzQ7vTc-3D2ESCnrNWnBQw+q@[93.236.144.216]) by fwd13.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1kK2xu-08uzLs0; Sun, 20 Sep 2020 19:17:30 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id EC356200613; Sun, 20 Sep 2020 19:17:29 +0200 (CEST) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann Subject: [PATCH 1/9] audio: handle buf == NULL in put_buffer_out() Date: Sun, 20 Sep 2020 19:17:21 +0200 Message-Id: <20200920171729.15861-1-vr_qemu@t-online.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <84f1c61a-8399-c75e-96c2-febfc2dd5fab@t-online.de> References: <84f1c61a-8399-c75e-96c2-febfc2dd5fab@t-online.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ID: JbTBTgZ1wh5e1YUvG8omkAi00eJ6ksRPSWkzSvHvuJpzQ7vTc-3D2ESCnrNWnBQw+q X-TOI-EXPURGATEID: 150726::1600622250-00003E0D-CF49BECB/0/0 CLEAN NORMAL X-TOI-MSGID: 40b6d91d-6ee8-420f-b398-9d75a203800e Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=194.25.134.85; envelope-from=volker.ruemelin@t-online.de; helo=mailout11.t-online.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/20 13:17:31 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-devel , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" With the next patch all audio backends put_buffer_out() functions have to handle the buf =3D=3D NULL case, provided the get_buffer_out() function may return buf =3D NULL and size > 0. It turns out that all audio backends get_buffer_out() functions either can't return buf =3D NULL or return buf =3D NULL and size =3D 0 at the same time. The only exception is the spiceaudio backend where size may be uninitialized. Signed-off-by: Volker R=C3=BCmelin --- audio/spiceaudio.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index b6b5da4812..c8d81ba442 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -135,6 +135,7 @@ static void *line_out_get_buffer(HWVoiceOut *hw, size_t= *size) (out->fsize - out->fpos) * hw->info.bytes_per_frame); } else { audio_rate_start(&out->rate); + *size =3D LINE_OUT_SAMPLES << 2; } return out->frame + out->fpos; } @@ -143,12 +144,14 @@ static size_t line_out_put_buffer(HWVoiceOut *hw, voi= d *buf, size_t size) { SpiceVoiceOut *out =3D container_of(hw, SpiceVoiceOut, hw); =20 - assert(buf =3D=3D out->frame + out->fpos && out->fpos <=3D out->fsize); - out->fpos +=3D size >> 2; + if (buf) { + assert(buf =3D=3D out->frame + out->fpos && out->fpos <=3D out->fs= ize); + out->fpos +=3D size >> 2; =20 - if (out->fpos =3D=3D out->fsize) { /* buffer full */ - spice_server_playback_put_samples(&out->sin, out->frame); - out->frame =3D NULL; + if (out->fpos =3D=3D out->fsize) { /* buffer full */ + spice_server_playback_put_samples(&out->sin, out->frame); + out->frame =3D NULL; + } } =20 return size; --=20 2.26.2