summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2019-09-10 07:49:15 +0000
committerratchov <ratchov@openbsd.org>2019-09-10 07:49:15 +0000
commit8fcfd0b7e67c3ef5ae25d1371ddd9a17dec1a138 (patch)
treef70e6e8a664386cf5d31ff88e590801f3e506148
parentIf the requensted block size is too large, then use half the (diff)
downloadwireguard-openbsd-8fcfd0b7e67c3ef5ae25d1371ddd9a17dec1a138.tar.xz
wireguard-openbsd-8fcfd0b7e67c3ef5ae25d1371ddd9a17dec1a138.zip
Prevents the block size from exceeding the requested one when a huge
block size is requested. This avoids exceeding half the buffer size.
-rw-r--r--sys/dev/pci/azalia.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 08995b531ad..277aed53ffc 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.251 2019/09/05 05:36:31 ratchov Exp $ */
+/* $OpenBSD: azalia.c,v 1.252 2019/09/10 07:49:15 ratchov Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -3978,8 +3978,9 @@ azalia_set_blksz(void *v, int mode,
/* must be multiple of 128 bytes */
mult = audio_blksz_bytes(mode, p, r, 128);
- blksz += mult - 1;
blksz -= blksz % mult;
+ if (blksz == 0)
+ blksz = mult;
return blksz;
}