NetBSD Problem Report #52433

From www@NetBSD.org  Thu Jul 27 08:58:19 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 399497A1FA
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 27 Jul 2017 08:58:19 +0000 (UTC)
Message-Id: <20170727085803.EFAF27A26F@mollari.NetBSD.org>
Date: Thu, 27 Jul 2017 08:58:03 +0000 (UTC)
From: isaki@NetBSD.org
Reply-To: isaki@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: Dead code in audio_open()
X-Send-Pr-Version: www-1.0

>Number:         52433
>Category:       kern
>Synopsis:       Dead code in audio_open()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    nat
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 27 09:00:00 +0000 2017
>Closed-Date:    Fri Jul 28 04:00:52 +0000 2017
>Last-Modified:  Tue Aug 01 23:30:00 +0000 2017
>Originator:     Tetsuya Isaki
>Release:        NetBSD-current
>Organization:
NetBSD
>Environment:
source code review
>Description:
Dead code in audio_open()

In sys/dev/audio.c, the expression at line 2167-2168 never be true.

2114 audio_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
2115     struct lwp *l, struct file **nfp)
2116 {
   :
2147     vc->sc_open = 0; 
2148     vc->sc_mode = 0; 
   :
2167     if (((flags & FREAD) && (vc->sc_open & AUOPEN_READ)) || 
2168         ((flags & FWRITE) && (vc->sc_open & AUOPEN_WRITE))) {
2169         kmem_free(vc, sizeof(struct virtual_channel));
2170         kmem_free(chan, sizeof(struct audio_chan));
2171         return EBUSY;
2172     }  

>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:43:46 +0000
Responsible-Changed-Why:
Take.


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

 Module Name:	src
 Committed By:	nat
 Date:		Fri Jul 28 03:58:54 UTC 2017

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

 Log Message:
 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.374 -r1.375 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: open->closed
State-Changed-By: nat@NetBSD.org
State-Changed-When: Fri, 28 Jul 2017 04:00:52 +0000
State-Changed-Why:
The dead code has been removed.  Thanks for the PR!


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52433 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.

>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.