qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Volker Rümelin" <vr_qemu@t-online.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [PULL 6/6] audio: fix integer overflow
Date: Mon,  6 Jan 2020 13:52:36 +0100	[thread overview]
Message-ID: <20200106125236.24132-7-kraxel@redhat.com> (raw)
In-Reply-To: <20200106125236.24132-1-kraxel@redhat.com>

From: Volker Rümelin <vr_qemu@t-online.de>

Tell the compiler to do a 32bit * 32bit -> 64bit multiplication
because period_ticks is a 64bit variable. The overflow occurs
for audio timer periods larger than 4294967us.

Fixes: be1092afa0 "audio: fix audio timer rate conversion bug"

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-id: 8893a235-66a8-8fbe-7d95-862e29da90b1@t-online.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 audio/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/audio/audio.c b/audio/audio.c
index 56fae5504710..abea027fdf69 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1738,7 +1738,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name)
     if (dev->timer_period <= 0) {
         s->period_ticks = 1;
     } else {
-        s->period_ticks = dev->timer_period * SCALE_US;
+        s->period_ticks = dev->timer_period * (int64_t)SCALE_US;
     }
 
     e = qemu_add_vm_change_state_handler (audio_vm_change_state_handler, s);
-- 
2.18.1



  parent reply	other threads:[~2020-01-06 12:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 12:52 [PULL 0/6] Audio 20200106 patches Gerd Hoffmann
2020-01-06 12:52 ` [PULL 1/6] hda-codec: fix playback rate control Gerd Hoffmann
2020-01-06 12:52 ` [PULL 2/6] hda-codec: fix recording " Gerd Hoffmann
2020-01-06 12:52 ` [PULL 3/6] paaudio: drop recording stream in qpa_fini_in Gerd Hoffmann
2020-01-06 12:52 ` [PULL 4/6] paaudio: try to drain the recording stream Gerd Hoffmann
2020-01-06 12:52 ` [PULL 5/6] paaudio: wait until the recording stream is ready Gerd Hoffmann
2020-01-06 12:52 ` Gerd Hoffmann [this message]
2020-01-06 17:44 ` [PULL 0/6] Audio 20200106 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200106125236.24132-7-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vr_qemu@t-online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).