> I'm not going to disagree with you too strongly, but I do note that the 
 > man page claims:
 > 
 >      These macros assume the message itself is well formed,  that
 >      is:  mp->b_datap->db_base <= mp->b_rptr <= mp->b_wptr <= mp-
 >      >b_datap->db_lim.

That claim should probably just be removed, as I think they will return
the "right" answer regardless.  I don't recall what prompted me to put
that in there -- maybe paranoia.

 > The other problem with casting to (int), is that if the mblk were *very* 
 > large, you might lose the high order bits.

I'm not aware of any cases where an mblk is 2^31 or greater.

 > Maybe a better solution is to insert an assertion at the right point, 
 > e.g. (casting and parenthesis omitted for clarity):
 > 
 > #ifdef DEBUG
 > #define   MBLKL(mp)   ((mp->b_wptr >= mp->b_rptr) ? mp->b_wptr - 
 > mp->b-rptr : ASSERT(mp->b_wptr >= mp->b_rptr)
 > #else
 > #define   MBLKL(mp)  ... use traditional definition here ...
 > #endif

If we could go back in time, I think that'd be good.  If we do it now, I
think we'll be hitting assertions for months.  Yes, it's good to find
those cases, but many of them will end up being benign.  I'd rather just
deal with the lint problems and leave other rocks associated with MBLKL()
and friends right-side-up for now.

--
meem
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to