misc/189845: UnNecessary Copy of Error Buffer in _kvm_open

Myron Walker myron.walker at emc.com
Thu May 15 22:50:00 UTC 2014


>Number:         189845
>Category:       misc
>Synopsis:       UnNecessary Copy of Error Buffer in _kvm_open
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 15 22:50:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Myron Walker
>Release:        
>Organization:
EMC
>Environment:
mwwsoftcluster0# uname -a
FreeBSD mwwsoftcluster0 11.0-CURRENT FreeBSD 11.0-CURRENT #0: Mon May  5 10:30:09 PDT 2014     root at bsd10build01.west.isilon.com:/build/mnt/obj/build/mnt/src/sys/IQ.amd64.debug  amd64

>Description:
_kvm_open in libkvm always returns 0 on a failure.  So writing a message to kd is pointless because it is immediately passed to kvm_close() and the memory is freed.  Se the code snippet below from _kvm_open.

        /*
	 * Copy out the error if doing sane error semantics.
	 */
	if (errout != 0)
		strlcpy(errout, kd->errbuf, _POSIX2_LINE_MAX);
	(void)kvm_close(kd);
	return (0);
>How-To-Repeat:

>Fix:
All error message code can be removed from _kvm_open because none of it is used anyway.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list