NetBSD Problem Report #50908
From www@NetBSD.org Mon Mar 7 12:12:13 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 D7D457A13F
for <gnats-bugs@gnats.NetBSD.org>; Mon, 7 Mar 2016 12:12:12 +0000 (UTC)
Message-Id: <20160307121211.F372D7ACBD@mollari.NetBSD.org>
Date: Mon, 7 Mar 2016 12:12:11 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/sbin/fsck_msdos/dir.c:988: clumsy call to memset ?
X-Send-Pr-Version: www-1.0
>Number: 50908
>Category: bin
>Synopsis: src/sbin/fsck_msdos/dir.c:988: 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:15:00 +0000 2016
>Closed-Date: Mon Mar 07 14:50:53 +0000 2016
>Last-Modified: Mon Mar 07 14:50:53 +0000 2016
>Originator: David Binderman
>Release: cvs dated 20160305
>Organization:
>Environment:
>Description:
[src/sbin/fsck_msdos/dir.c:988] -> [src/sbin/fsck_msdos/dir.c:989]: (performance) Buffer 'p' is being written before its old content has been used.
[src/sbin/fsck_msdos/dir.c:988] -> [src/sbin/fsck_msdos/dir.c:990]: (performance) Buffer 'p' is being written before its old content has been used.
Source code is
memset(p, 0, 32);
memset(p, ' ', 11);
memcpy(p, d.name, strlen(d.name));
Maybe better code
memset(p + 11, 0, 32 - 11);
memset(p, ' ', 11);
memcpy(p, d.name, strlen(d.name));
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/50908 CVS commit: src/sbin/fsck_msdos
Date: Mon, 7 Mar 2016 09:47:25 -0500
Module Name: src
Committed By: christos
Date: Mon Mar 7 14:47:25 UTC 2016
Modified Files:
src/sbin/fsck_msdos: dir.c
Log Message:
PR/50908: David Binderman: Optimize memset's
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/fsck_msdos/dir.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 14:50:53 +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.