From owner-cvs-all@FreeBSD.ORG Sun Jun 4 20:27:54 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 C21F816A61E; Sun, 4 Jun 2006 20:27:54 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92DA043D49; Sun, 4 Jun 2006 20:27:54 +0000 (GMT) (envelope-from marcel@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k54KQDaC051695; Sun, 4 Jun 2006 20:26:13 GMT (envelope-from marcel@repoman.freebsd.org) Received: (from marcel@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k54KQDRp051694; Sun, 4 Jun 2006 20:26:13 GMT (envelope-from marcel) Message-Id: <200606042026.k54KQDRp051694@repoman.freebsd.org> From: Marcel Moolenaar Date: Sun, 4 Jun 2006 20:26:13 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/geom geom_gpt.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: Sun, 04 Jun 2006 20:28:06 -0000 marcel 2006-06-04 20:26:13 UTC FreeBSD src repository Modified files: sys/geom geom_gpt.c Log: Fix unaligned memory accesses on Alpha and possible other platforms. By using a pointer to struct dos_partition, we implicitly tell the compiler that the pointer is 4-bytes aligned, even though we know that's not the case. The fact that we only dereference the pointer to access a byte-wide field (field dp_ptyp) is not a guarantee that the compiler will in fact use a byte-wide load. On some platforms it's more efficient to use long word or quad word loads and use bit-shifting and bit-masking to get the intended byte. On those platforms an misaligned load will be the result. The fix is to use byte-wide pointer arithmetic based on sizeof() and offsetof() to avoid invalid casts which avoids that the compiler makes invalid assumptions. Backtrace provided by: wilko@ MFC after: 1 week Revision Changes Path 1.38 +4 -3 src/sys/geom/geom_gpt.c