Subject: kern/26597: LKM - page size abuse
To: None <gnats-bugs@gnats.NetBSD.org>
From: Peter Postma <peter@pointless.nl>
List: netbsd-bugs
Date: 08/08/2004 20:34:41
>Number:         26597
>Category:       kern
>Synopsis:       LKM - page size abuse
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 08 19:01:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Peter Postma
>Release:        NetBSD 2.0G
>Organization:
>Environment:
System: NetBSD mercury.pointless.nl 2.0G NetBSD 2.0G (mercury) #46: Sun Aug 8 18:20:53 CEST 2004 peter@mercury.pointless.nl:/usr/obj/sys/arch/sparc64/compile/mercury sparc64
Architecture: sparc64
Machine: sparc64
>Description:
While reading the LKM code (sys/kern/kern_lkm.c), I saw this:

line 90: #define PAGESIZE 1024		/* kmem_alloc() allocation quantum */

line 575: statp->size	= curp->size / PAGESIZE;

This can't be right to redefine the page size with another value
(page size is 8192 on sparc64) and use that in the stats.

>How-To-Repeat:
Read the code.

>Fix:
Remove "#define PAGESIZE" and replace PAGESIZE at line 575 with "PAGE_SIZE".
>Release-Note:
>Audit-Trail:
>Unformatted: