Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jun 2005 21:50:22 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79196 for review
Message-ID:  <200506292150.j5TLoMeY047427@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79196

Change 79196 by peter@peter_daintree on 2005/06/29 21:50:17

	OK, kvm_kvatop() should have been off_t.
	While here, fix the type of pa that we pass a pointer
	to - fixed potential stack corruption here on 32 bit platform.

Affected files ...

.. //depot/projects/hammer/lib/libkvm/kvm.c#6 edit
.. //depot/projects/hammer/lib/libkvm/kvm_private.h#3 edit

Differences ...

==== //depot/projects/hammer/lib/libkvm/kvm.c#6 (text+ko) ====

@@ -369,7 +369,7 @@
 	} else {
 		cp = buf;
 		while (len > 0) {
-			u_long pa;
+			off_t pa;
 
 			cc = _kvm_kvatop(kd, kva, &pa);
 			if (cc == 0)
@@ -377,7 +377,7 @@
 			if (cc > len)
 				cc = len;
 			errno = 0;
-			if (lseek(kd->pmfd, (off_t)pa, 0) == -1 && errno != 0) {
+			if (lseek(kd->pmfd, pa, 0) == -1 && errno != 0) {
 				_kvm_syserr(kd, 0, _PATH_MEM);
 				break;
 			}

==== //depot/projects/hammer/lib/libkvm/kvm_private.h#3 (text+ko) ====

@@ -75,7 +75,7 @@
 void	 _kvm_freeprocs(kvm_t *kd);
 void	 _kvm_freevtop(kvm_t *);
 int	 _kvm_initvtop(kvm_t *);
-int	 _kvm_kvatop(kvm_t *, u_long, uint64_t *);
+int	 _kvm_kvatop(kvm_t *, u_long, off_t *);
 void	*_kvm_malloc(kvm_t *kd, size_t);
 void	*_kvm_realloc(kvm_t *kd, void *, size_t);
 void	 _kvm_syserr (kvm_t *kd, const char *program, const char *fmt, ...)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506292150.j5TLoMeY047427>