NetBSD Problem Report #51150

From www@NetBSD.org  Wed May 18 13:16:57 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 288FA7A468
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 18 May 2016 13:16:57 +0000 (UTC)
Message-Id: <20160518131656.11ECA7A496@mollari.NetBSD.org>
Date: Wed, 18 May 2016 13:16:56 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sys/arch/evbarm/imx7/imx7_machdep.c: possible read uninit memory ?
X-Send-Pr-Version: www-1.0

>Number:         51150
>Category:       port-evbarm
>Synopsis:       src/sys/arch/evbarm/imx7/imx7_machdep.c: possible read uninit memory ?
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 18 13:20:00 +0000 2016
>Closed-Date:    Mon May 30 17:49:22 +0000 2016
>Last-Modified:  Mon May 30 17:49:22 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160518
>Organization:
>Environment:
>Description:
[src/sys/arch/evbarm/imx7/imx7_machdep.c:222]: (error) Uninitialized variable: memsize

Source code is

#ifdef MEMSIZE
    memsize = MEMSIZE * 1024 * 1024;
#endif

    bootconfig.dramblocks = 1;
    bootconfig.dram[0].address = KERN_VTOPHYS(KERNEL_BASE);
    bootconfig.dram[0].pages = memsize / PAGE_SIZE;

but

   psize_t memsize;

Suggest init local variable memsize at its declaration.

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51150 CVS commit: src/sys/arch/evbarm/imx7
Date: Mon, 30 May 2016 17:43:46 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Mon May 30 17:43:46 UTC 2016

 Modified Files:
 	src/sys/arch/evbarm/imx7: imx7_machdep.c

 Log Message:
 If MEMSIZE isn't set, #error instead of proceeding using uninitialized
 stack garbage as the memory size. Please improve as needed; I don't know
 anything about this hardware.

 PR 51150 from David Binderman.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/imx7/imx7_machdep.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: Mon, 30 May 2016 17:49:22 +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.