NetBSD Problem Report #51297

From www@NetBSD.org  Thu Jun 30 08:39:17 2016
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 "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 178357A220
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 30 Jun 2016 08:39:17 +0000 (UTC)
Message-Id: <20160630083916.314A97A46B@mollari.NetBSD.org>
Date: Thu, 30 Jun 2016 08:39:16 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/arch/ia64/unwind/stackframe.c; 4 * poor error checking ?
X-Send-Pr-Version: www-1.0

>Number:         51297
>Category:       port-ia64
>Synopsis:       src/sys/arch/ia64/unwind/stackframe.c; 4 * poor error checking ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-ia64-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 30 08:40:00 +0000 2016
>Closed-Date:    Sun Jul 31 19:33:37 +0000 2016
>Last-Modified:  Sun Jul 31 19:33:37 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160630
>Organization:
>Environment:
>Description:
1.

src/sys/arch/ia64/unwind/stackframe.c:1172]: (style) Checking if unsigned variable 'iprel' is less than zero.

Source code is

   if (iprel < 0) {

but

patchunwindframe(struct unwind_frame *uwf, uint64_t iprel, uint64_t relocoffset)

Maybe there is some other test that can be applied to iprel to sanity check it.

2.

src/sys/arch/ia64/unwind/stackframe.c:950]: (style) Checking if unsigned variable 'rdepth' is less than zero.

            if (rdepth < 0) goto out; /* Overshot Region containing procoffset. Bailout. */

but

   uint64_t rdepth = 0;        /* Offset within current region */

3.

src/sys/arch/ia64/unwind/stackframe.c:961]: (style) Checking if unsigned variable 'rdepth' is less than zero.

4.

src/sys/arch/ia64/unwind/stackframe.c:972]: (style) Checking if unsigned variable 'rdepth' is less than zero.

Duplicates.

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51297 CVS commit: src/sys/arch/ia64
Date: Sun, 31 Jul 2016 19:10:55 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sun Jul 31 19:10:54 UTC 2016

 Modified Files:
 	src/sys/arch/ia64/ia64: db_trace.c
 	src/sys/arch/ia64/unwind: stackframe.c

 Log Message:
 Don't check for unsigned variables being less than 0 in
 patchunwindframe(). Instead, check before subtracting, which in this
 case means at the call site.

 It would probably be better to change the call signature so the
 subtraction happens inside patchunwindframe(), but since I don't
 really know exactly what this code is trying to do I'm not comfortable
 changing it.

 Issue 1 in PR 51297 from David Binderman.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/sys/arch/ia64/ia64/db_trace.c
 cvs rdiff -u -r1.5 -r1.6 src/sys/arch/ia64/unwind/stackframe.c

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

From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51297 CVS commit: src/sys/arch/ia64/unwind
Date: Sun, 31 Jul 2016 19:12:41 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sun Jul 31 19:12:41 UTC 2016

 Modified Files:
 	src/sys/arch/ia64/unwind: stackframe.c

 Log Message:
 Instead of testing for unsigned < 0, compare before subtracting.
 Reset of PR 51297 from David Binderman.


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/unwind/stackframe.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: dholland@NetBSD.org
State-Changed-When: Sun, 31 Jul 2016 19:33:37 +0000
State-Changed-Why:
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.