NetBSD Problem Report #52435

From www@NetBSD.org  Thu Jul 27 09:53:33 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 03C467A234
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 27 Jul 2017 09:53:33 +0000 (UTC)
Message-Id: <20170727095332.2CDA47A26F@mollari.NetBSD.org>
Date: Thu, 27 Jul 2017 09:53:32 +0000 (UTC)
From: isaki@NetBSD.org
Reply-To: isaki@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: audio.c: mismatch of the maximum number of channels?
X-Send-Pr-Version: www-1.0

>Number:         52435
>Category:       kern
>Synopsis:       audio.c: mismatch of the maximum number of channels?
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    nat
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 27 09:55:00 +0000 2017
>Closed-Date:    Wed Aug 16 19:39:53 +0000 2017
>Last-Modified:  Wed Aug 16 19:39:53 +0000 2017
>Originator:     Tetsuya Isaki
>Release:        NetBSD-current
>Organization:
NetBSD
>Environment:
source code review
>Description:
In audio.c, vchan_autoconfig() seems to search number of channels of
device by auto_config_channels[] array ( 32, 24, 16, 8, ... ).

On the other hand, audio_check_params() rejects number of channels > 12
(AUDIO_MAX_CHANNELS defined in sys/dev/audioi_if.h).

audio_check_params() is called from audiosetinfo() and
it is called from audio_set_vchan_default() and
it is called from vchan_autoconfig().

Is there no problem?


sys/dev/audio.c:
 450 int auto_config_precision[] = { 32, 16, 8 };
 451 int auto_config_channels[] = { 32, 24, 16, 8, 6, 4, 2, 1};
   :
4071 int
4072 audio_check_params(struct audio_params *p)
4073 {
   :
4139         /* sanity check # of channels*/
4140         if (p->channels < 1 || p->channels > AUDIO_MAX_CHANNELS)
4141                 return EINVAL;
4142
4143         return 0;
4144 }


>How-To-Repeat:
see source code.
>Fix:
N/A

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Fri, 28 Jul 2017 02:45:27 +0000
Responsible-Changed-Why:
Take.


State-Changed-From-To: open->feedback
State-Changed-By: nat@NetBSD.org
State-Changed-When: Fri, 28 Jul 2017 02:55:56 +0000
State-Changed-Why:
Should be fixed now.  Please try a kernel from -current and report back.


From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52435 CVS commit: src/sys/dev
Date: Fri, 28 Jul 2017 02:53:54 +0000

 Module Name:	src
 Committed By:	nat
 Date:		Fri Jul 28 02:53:54 UTC 2017

 Modified Files:
 	src/sys/dev: audio.c

 Log Message:
 Refactoring of order of auto config combinations.  Most common formats
 come first.

 Do not exceed AUDIO_MAX_CHANNELS.

 Addresses PR kern/52435.


 To generate a diff of this commit:
 cvs rdiff -u -r1.372 -r1.373 src/sys/dev/audio.c

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

From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: gnats-bugs@NetBSD.org
Cc: nat@NetBSD.org,
	netbsd-bugs@netbsd.org,
	gnats-admin@netbsd.org
Subject: Re: kern/52435 (audio.c: mismatch of the maximum number of channels?)
Date: Fri, 28 Jul 2017 13:33:59 +0900

 At Fri, 28 Jul 2017 02:55:56 +0000 (UTC),
 nat@NetBSD.org wrote:
 > Should be fixed now.  Please try a kernel from -current and report back.

 It was noticed by source code review and I don't have these
 environment.  Please close it if there is no other objection.
 Thank you.
 ---
 Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>

From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52435 CVS commit: [netbsd-8] src/sys/dev
Date: Tue, 1 Aug 2017 23:25:11 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Tue Aug  1 23:25:11 UTC 2017

 Modified Files:
 	src/sys/dev [netbsd-8]: audio.c

 Log Message:
 Pull up following revision(s) (requested by nat in ticket #167):
 	sys/dev/audio.c: revision 1.373
 	sys/dev/audio.c: revision 1.374
 	sys/dev/audio.c: revision 1.375
 Refactoring of order of auto config combinations.  Most common formats
 come first.
 Do not exceed AUDIO_MAX_CHANNELS.
 Addresses PR kern/52435.
 --
 Remove unused code from audio_set_params.
 Addresses PR kern/52434.
 --
 Remove dead code from audio open.  Found by isaki@.
 Better error handling incase memory for the streams' ringbuffers cannot be
 allocated.
 Addresses PR kern/52433.


 To generate a diff of this commit:
 cvs rdiff -u -r1.357.2.3 -r1.357.2.4 src/sys/dev/audio.c

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

State-Changed-From-To: feedback->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Wed, 16 Aug 2017 19:39:53 +0000
State-Changed-Why:
Confirmed fixed.  Thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.