From owner-cvs-src@FreeBSD.ORG Thu Dec 6 10:25:05 2007 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33BB016A41B; Thu, 6 Dec 2007 10:25:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail13.syd.optusnet.com.au (mail13.syd.optusnet.com.au [211.29.132.194]) by mx1.freebsd.org (Postfix) with ESMTP id A945513C468; Thu, 6 Dec 2007 10:25:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-219-213.carlnfd3.nsw.optusnet.com.au (c211-30-219-213.carlnfd3.nsw.optusnet.com.au [211.30.219.213]) by mail13.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id lB6AP1Hx025799 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 6 Dec 2007 21:25:02 +1100 Date: Thu, 6 Dec 2007 21:25:01 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Kip Macy In-Reply-To: <200712060400.lB640xxi025146@repoman.freebsd.org> Message-ID: <20071206202639.N11122@delplex.bde.org> References: <200712060400.lB640xxi025146@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys param.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Dec 2007 10:25:05 -0000 On Thu, 6 Dec 2007, Kip Macy wrote: > kmacy 2007-12-06 04:00:59 UTC > > FreeBSD src repository > > Modified files: > sys/sys param.h > Log: > Respect the fact that the value a may be constant so cast to const uint8_t * > > Revision Changes Path > 1.318 +2 -2 src/sys/sys/param.h The correct fix is to back out 1.317. If not, at least spell `unsigned char' correctly and fix the other new style bug (a line longer than 80 characters from adding `const'). Using uint8_t is only a style bug since POSIX probably requires unsigned char to be the same as uint8_t. If unsigned char is larger than uint8_t, then revs.1.317-318 give undefined behaviour (aliasing bugs) and clearly broken behaviour (wrong divisor NBBY). These bugs are easy to avoid by using the correct spelling. The case where the pointer is to volatile unsigned char remains broken, and shouldn't be fixed by always casting to volatile const unsigned char *. It almost makes sense to use the original macros on volatiles (volatility would guarantee certain accesses), but casting to a smaller type is guaranteed to give different accesses, so always casting to volatile would silently break some cases (cases which didn't work before). Bruce