Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Nov 1997 23:04:01 -0500 (EST)
From:      Chuck Robey <chuckr@glue.umd.edu>
To:        "Jamil J. Weatherbee" <jamil@trojanhorse.ml.org>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Possible Kernel Bug?
Message-ID:  <Pine.BSF.3.96.971110225127.27308M-100000@picnic.mat.net>
In-Reply-To: <Pine.BSF.3.96.971110194629.1253A-100000@trojanhorse.ml.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 10 Nov 1997, Jamil J. Weatherbee wrote:

> 
> 
> I may be dead wrong about this but it is worth a try:
> 
> void *data;
> void *data_end;
> 
> lets say you are passed a struct buf with a data buffer bp->b_data
> and bp->b_bcount = 1000;
> 
> if you say data = bp->b_data /* this is fine */
> what about data_end = bp->b_data + bp->b_bcount  /* this pointer could
> point to something nonexistent??? */

Dereferencing a void pointer won't work, because a void * is an example of
a invalid pointer (unless casted to another type).  "An attempt to
dereference an invalid pointer may cause a run-time error" is from
Harbison & Steele, section 5.3.2, page 110. 

Also illegal to do math on a void * (page 188).

> 
> so dereferencing it is definetly a no no (and that is not being done) but
> I see places where data compared to data_end , now since caddr_t is
> defined as , such as while (data < data_end)
> 
> typedef char *caddr_t;
> which i assume is represented as a 32 bit unsigned integer
> 
> are you guaranteed that the byte 0xffffffff is never allocated?
> this should be true in addition to 0x00000000 never being allocated.
> 
> 
> 
> 
> 

----------------------------+-----------------------------------------------
Chuck Robey                 | Interests include any kind of voice or data 
chuckr@glue.umd.edu         | communications topic, C programming, and Unix.
213 Lakeside Drive Apt T-1  |
Greenbelt, MD 20770         | I run Journey2 and picnic, both FreeBSD
(301) 220-2114              | version 3.0 current -- and great FUN!
----------------------------+-----------------------------------------------







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971110225127.27308M-100000>