CVS commit: src/sys/compat/ossaudio

2023-06-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 20 15:22:05 UTC 2023

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
compat_ossaudio: Zero-initialize idat before copyout.

Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.84 src/sys/compat/ossaudio/ossaudio.c:1.85
--- src/sys/compat/ossaudio/ossaudio.c:1.84	Tue Sep  7 11:43:05 2021
+++ src/sys/compat/ossaudio/ossaudio.c	Tue Jun 20 15:22:04 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.84 2021/09/07 11:43:05 riastradh Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.85 2023/06/20 15:22:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.84 2021/09/07 11:43:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.85 2023/06/20 15:22:04 riastradh Exp $");
 
 #include 
 #include 
@@ -1069,7 +1069,7 @@ oss_ioctl_mixer(struct lwp *lwp, const s
 	mixer_ctrl_t mc;
 	struct oss_mixer_info omi;
 	struct audio_device adev;
-	int idat;
+	int idat = 0;
 	int i;
 	int error;
 	int l, r, n, e;



CVS commit: src/sys/compat/ossaudio

2023-06-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jun 20 15:22:05 UTC 2023

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
compat_ossaudio: Zero-initialize idat before copyout.

Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/compat/ossaudio

2019-11-02 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Nov  2 11:56:34 UTC 2019

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.76 src/sys/compat/ossaudio/ossaudio.c:1.77
--- src/sys/compat/ossaudio/ossaudio.c:1.76	Thu Sep 26 01:37:52 2019
+++ src/sys/compat/ossaudio/ossaudio.c	Sat Nov  2 11:56:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.76 2019/09/26 01:37:52 christos Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.77 2019/11/02 11:56:34 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.76 2019/09/26 01:37:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.77 2019/11/02 11:56:34 isaki Exp $");
 
 #include 
 #include 
@@ -238,7 +238,10 @@ oss_ioctl_audio(struct lwp *l, const str
 			 __func__, error));
 			goto out;
 		}
-		idat = tmpinfo.play.sample_rate;
+		if (tmpinfo.mode == AUMODE_RECORD)
+			idat = tmpinfo.record.sample_rate;
+		else
+			idat = tmpinfo.play.sample_rate;
 		DPRINTF(("%s: SNDCTL_PCM_READ_RATE < %d\n", __func__, idat));
 		error = copyout(&idat, SCARG(uap, data), sizeof idat);
 		if (error) {



CVS commit: src/sys/compat/ossaudio

2019-11-02 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Nov  2 11:56:34 UTC 2019

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/compat/ossaudio

2019-09-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 26 01:37:53 UTC 2019

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
- "source" is u_long in the kernel (and int in userland). Cast -1 to u_long.
- make "s" unsigned since blocksize is too.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.75 src/sys/compat/ossaudio/ossaudio.c:1.76
--- src/sys/compat/ossaudio/ossaudio.c:1.75	Fri Aug 23 08:42:14 2019
+++ src/sys/compat/ossaudio/ossaudio.c	Wed Sep 25 21:37:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.75 2019/08/23 12:42:14 maxv Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.76 2019/09/26 01:37:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.75 2019/08/23 12:42:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.76 2019/09/26 01:37:52 christos Exp $");
 
 #include 
 #include 
@@ -1087,7 +1087,7 @@ oss_ioctl_mixer(struct lwp *lwp, const s
 		}
 		break;
 	case OSS_SOUND_MIXER_READ_RECSRC:
-		if (di->source == -1) {
+		if (di->source == (u_long)-1) {
 			DPRINTF(("%s: OSS_SOUND_MIXER_READ_RECSRC bad source\n",
 			__func__));
 			error = EINVAL;
@@ -1132,7 +1132,7 @@ oss_ioctl_mixer(struct lwp *lwp, const s
 		break;
 	case OSS_SOUND_MIXER_WRITE_RECSRC:
 	case OSS_SOUND_MIXER_WRITE_R_RECSRC:
-		if (di->source == -1) {
+		if (di->source == (u_long)-1) {
 			DPRINTF(("%s: OSS_SOUND_MIXER_WRITE_RECSRC bad "
 			"source\n", __func__));
 			error = EINVAL;
@@ -1492,11 +1492,11 @@ static void
 setblocksize(file_t *fp, struct audio_info *info)
 {
 	struct audio_info set;
-	int s;
+	u_int s;
 
-	 if (info->blocksize & (info->blocksize-1)) {
+	 if (info->blocksize & (info->blocksize - 1)) {
 		for(s = 32; s < info->blocksize; s <<= 1)
-			;
+			continue;
 		AUDIO_INITINFO(&set);
 		set.blocksize = s;
 		fp->f_ops->fo_ioctl(fp, AUDIO_SETINFO, &set);



CVS commit: src/sys/compat/ossaudio

2019-09-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 26 01:37:53 UTC 2019

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
- "source" is u_long in the kernel (and int in userland). Cast -1 to u_long.
- make "s" unsigned since blocksize is too.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/compat/ossaudio

2019-08-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 23 12:42:14 UTC 2019

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
Fix error handling, returns an errno, not -1.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/compat/ossaudio

2019-08-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 23 12:42:14 UTC 2019

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
Fix error handling, returns an errno, not -1.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/compat/ossaudio/ossaudio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.74 src/sys/compat/ossaudio/ossaudio.c:1.75
--- src/sys/compat/ossaudio/ossaudio.c:1.74	Sun Feb  3 03:19:26 2019
+++ src/sys/compat/ossaudio/ossaudio.c	Fri Aug 23 12:42:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.74 2019/02/03 03:19:26 mrg Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.75 2019/08/23 12:42:14 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.74 2019/02/03 03:19:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.75 2019/08/23 12:42:14 maxv Exp $");
 
 #include 
 #include 
@@ -966,7 +966,7 @@ getdevinfo(file_t *fp)
 	}
 	for(i = 0; i < NETBSD_MAXDEVS; i++) {
 		mi.index = i;
-		if (ioctlf(fp, AUDIO_MIXER_DEVINFO, &mi) < 0)
+		if (ioctlf(fp, AUDIO_MIXER_DEVINFO, &mi) != 0)
 			break;
 		switch(mi.type) {
 		case AUDIO_MIXER_VALUE:
@@ -994,7 +994,7 @@ getdevinfo(file_t *fp)
 	}
 	for(i = 0; i < NETBSD_MAXDEVS; i++) {
 		mi.index = i;
-		if (ioctlf(fp, AUDIO_MIXER_DEVINFO, &mi) < 0)
+		if (ioctlf(fp, AUDIO_MIXER_DEVINFO, &mi) != 0)
 			break;
 		if (strcmp(mi.label.name, AudioNsource) != 0)
 			continue;