NetBSD Problem Report #50910
From www@NetBSD.org Mon Mar 7 12:19:32 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 7C2427ABE5
for <gnats-bugs@gnats.NetBSD.org>; Mon, 7 Mar 2016 12:19:32 +0000 (UTC)
Message-Id: <20160307121931.AAB427ACC0@mollari.NetBSD.org>
Date: Mon, 7 Mar 2016 12:19:31 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sbin/newfs/mkfs.c:739: clumsy call to memset ?
X-Send-Pr-Version: www-1.0
>Number: 50910
>Category: bin
>Synopsis: src/sbin/newfs/mkfs.c:739: clumsy call to memset ?
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Mar 07 12:20:00 +0000 2016
>Closed-Date: Mon Mar 07 16:10:32 +0000 2016
>Last-Modified: Mon Mar 07 16:10:32 +0000 2016
>Originator: David Binderman
>Release: cvs dated 20160305
>Organization:
>Environment:
>Description:
src/sbin/newfs/mkfs.c:739]: (performance) Buffer 'iobuf' is being written before its old content has been used.
Source code is
memset(iobuf, 0, i);
memcpy(iobuf, &sblock, sizeof sblock);
Maybe better code
memcpy(iobuf, &sblock, sizeof sblock);
memset(iobuf + sizeof sblock, 0, i - sizeof sblock);
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50910 CVS commit: src/sbin/newfs
Date: Mon, 7 Mar 2016 10:55:06 -0500
Module Name: src
Committed By: christos
Date: Mon Mar 7 15:55:06 UTC 2016
Modified Files:
src/sbin/newfs: mkfs.c
Log Message:
PR/50910: David Binderman: Optimize memset.
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sbin/newfs/mkfs.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: wiz@NetBSD.org
State-Changed-When: Mon, 07 Mar 2016 16:10:32 +0000
State-Changed-Why:
Fixed by christos, thanks!
>Unformatted:
(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.