NetBSD Problem Report #53029
From www@NetBSD.org Wed Feb 14 14:22:54 2018
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" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2835B7A1BC
for <gnats-bugs@gnats.NetBSD.org>; Wed, 14 Feb 2018 14:22:54 +0000 (UTC)
Message-Id: <20180214142253.63E677A262@mollari.NetBSD.org>
Date: Wed, 14 Feb 2018 14:22:53 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/dev/hdaudio/hdafg.c:1267: dead code block ?
X-Send-Pr-Version: www-1.0
>Number: 53029
>Category: kern
>Synopsis: src/sys/dev/hdaudio/hdafg.c:1267: dead code block ?
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Feb 14 14:25:00 +0000 2018
>Closed-Date: Wed Feb 14 18:30:09 +0000 2018
>Last-Modified: Wed Feb 14 18:35:01 +0000 2018
>Originator: David Binderman
>Release: cvs-20180214
>Organization:
>Environment:
>Description:
[src/sys/dev/hdaudio/hdafg.c:1268]: (warning) Opposite inner 'if' condition leads to a dead code block.
Source code is
for (i = sc->sc_startnode; cnt < maxctls && i < sc->sc_endnode; i++) {
if (cnt >= maxctls) {
hda_error(sc, "ctl overflow\n");
break;
}
Suggest remove dead code.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: kern/53029: src/sys/dev/hdaudio/hdafg.c:1267: dead code block ?
Date: Wed, 14 Feb 2018 18:22:41 +0000
i'm curious about
if (cnt >= maxctls)
break;
ctl[cnt].ctl_offset = offset;
ctl[cnt].ctl_left = offset;
ctl[cnt].ctl_right = offset;
ctl[cnt].ctl_ndir = HDAUDIO_PINDIR_IN;
ctl[cnt++].ctl_dir = HDAUDIO_PINDIR_IN;
which looks (pattern-wise) like an out of boudn write
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Wed, 14 Feb 2018 18:30:09 +0000
State-Changed-Why:
Applied, thanks! also, sorry for the unrelated comment, the increment is after, and I got confused.
From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/53029 CVS commit: src/sys/dev/hdaudio
Date: Wed, 14 Feb 2018 18:28:43 +0000
Module Name: src
Committed By: maya
Date: Wed Feb 14 18:28:43 UTC 2018
Modified Files:
src/sys/dev/hdaudio: hdafg.c
Log Message:
Remove dead code.
From David Binderman in PR kern/53029
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/hdaudio/hdafg.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.