summaryrefslogtreecommitdiff
path: root/sys/dev/pci/azalia.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2019-09-10 07:49:16 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2019-09-10 07:49:16 +0000
commit2da5ab71c651f74859a27cc8cc8509cb28465def (patch)
treeaa47731ae684bc3a6ab4e7cf400abf059920bee6 /sys/dev/pci/azalia.c
parent7840f887c972cb421c452fd5ad6fd37ed9352c82 (diff)
Prevents the block size from exceeding the requested one when a huge
block size is requested. This avoids exceeding half the buffer size.
Diffstat (limited to 'sys/dev/pci/azalia.c')
-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;
}