From owner-cvs-all@FreeBSD.ORG Thu Oct 26 20:39:51 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1079B16A407; Thu, 26 Oct 2006 20:39:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (vlsi00.si.noda.tus.ac.jp [133.31.130.32]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A45E43D46; Thu, 26 Oct 2006 20:39:50 +0000 (GMT) (envelope-from hrs@FreeBSD.org) Received: from delta.allbsd.org (p2118-ipbf608funabasi.chiba.ocn.ne.jp [125.175.93.118]) (authenticated bits=128) by mail.allbsd.org (8.13.1/8.13.4) with ESMTP id k9QKdZQE086163; Fri, 27 Oct 2006 05:39:48 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (alph.allbsd.org [192.168.0.10]) (authenticated bits=0) by delta.allbsd.org (8.13.4/8.13.4) with ESMTP id k9QKH4tT027987; Fri, 27 Oct 2006 05:17:05 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Fri, 27 Oct 2006 05:16:37 +0900 (JST) Message-Id: <20061027.051637.115993470.hrs@allbsd.org> To: tanimura@FreeBSD.org, re@FreeBSD.org From: Hiroki Sato In-Reply-To: <200610150504.k9F548ld008933@repoman.freebsd.org> References: <200610150504.k9F548ld008933@repoman.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 5.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Fri_Oct_27_05_16_37_2006_905)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88.2, clamav-milter version 0.88.2 on gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (mail.allbsd.org [133.31.130.32]); Fri, 27 Oct 2006 05:39:48 +0900 (JST) Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/pci agp.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2006 20:39:51 -0000 ----Security_Multipart(Fri_Oct_27_05_16_37_2006_905)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Seigo Tanimura wrote in <200610150504.k9F548ld008933@repoman.freebsd.org>: ta> tanimura 2006-10-15 05:04:07 UTC ta> ta> FreeBSD src repository ta> ta> Modified files: ta> sys/pci agp.c ta> Log: ta> Fix the wraparound of memsize >=2GB. ta> ta> Revision Changes Path ta> 1.54 +3 -2 src/sys/pci/agp.c I have doubt about this change because int memsize->u_int memsize does not solve the problem directly; memsize never occurs wraparound actually and an implicit cast to unsigned int just makes the problem invisible. The questionable code fragment in agp.c is the following: memsize = ptoa(Maxmem) >> 20; for (i = 0; i < agp_max_size; i++) { if (memsize <= agp_max[i][0]) break; } ptoa(Maxmem)>>20 will occur a wraparound problem when Maxmem>=2GB, so this part should be fixed instead. BTW, this should be a problem only on i386 since the definition of ptoa() is "#define ptoa(x) ((x) << PAGE_SHIFT)". The other platforms use a cast like "#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT)". I think it can be solved by using "ptoa((unsigned long)Maxmem)" or so, but I am not sure if this is reasonable because there are more notional types like vm_paddr_t. If "#define ptoa(x) ((vm_paddr_t)(x) << PAGE_SHIFT)" works fine on all platforms, it looks more reasonable to me, but I have a misunderstanding? -- | Hiroki SATO ----Security_Multipart(Fri_Oct_27_05_16_37_2006_905)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQBFQRenTyzT2CeTzy0RAicwAJ4j9uhCcWHrdHHt50rn7kpgtKkOtQCfZJzg WOMIuEdSAL9jIJs1aR+NKGY= =T7Vu -----END PGP SIGNATURE----- ----Security_Multipart(Fri_Oct_27_05_16_37_2006_905)----