Cast the argument to ptoa() to a vaddr_t to prevent an integer overflow

from occurring on systems with more than 2G of RAM.
This commit is contained in:
thorpej 1999-11-30 19:31:05 +00:00
parent a7ee57948b
commit fd9aa8fbba
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_param.h,v 1.21 1999/04/11 00:59:07 simonb Exp $ */
/* $NetBSD: vm_param.h,v 1.22 1999/11/30 19:31:05 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -138,7 +138,7 @@ typedef int boolean_t;
*/
#ifdef _KERNEL
#define atop(x) (((unsigned long)(x)) >> PAGE_SHIFT)
#define ptoa(x) ((vaddr_t)((x) << PAGE_SHIFT))
#define ptoa(x) ((vaddr_t)((vaddr_t)(x) << PAGE_SHIFT))
/*
* Round off or truncate to the nearest page. These will work