• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: KPI, mbuf, strange mbuf and mbuf_len strange definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: KPI, mbuf, strange mbuf and mbuf_len strange definition


  • Subject: Re: KPI, mbuf, strange mbuf and mbuf_len strange definition
  • From: Josh Graessley <email@hidden>
  • Date: Thu, 8 Dec 2005 11:38:20 -0800


The mismatch could lead to problems, however, an mbuf length of less than zero is invalid. The length is an absolute length. It makes no sense for it to be less than 0. The internal implementation hasn't switched over to an unsigned type yet. It is conceivable that there are bugs with the conversion between the two. In the long run, the length should be unsigned so the KPI is correct.


-josh

On Dec 8, 2005, at 11:25 AM, Stephane Sudre wrote:

Could there be a problem with the declaration of mbuf_len?

size_t mbuf_len(mbuf_t mbuf);

size_t is said to be a __darwin_size_t

__darwin_size_t is said to be __SIZE_TYPE__

__SIZE_TYPE__ is said to be long unsigned int (from what I've found with google).

My problem is that the m_hdr struct is stating (in the xnu source code):

struct m_hdr {
    struct    mbuf *mh_next;        /* next buffer in chain */
    struct    mbuf *mh_nextpkt;    /* next chain in queue/record */
    long    mh_len;            /* amount of data in this mbuf */

so mh_len is signed if I'm not mistaken.

This is a bit "funny" when you're trying to deal with this kind of weird mbuf chain :

p *((struct mbuf *) 0x3d1fd100)
$3 = {
  m_hdr = {
    mh_next = 0x3d221700,
    mh_nextpkt = 0x0,
    mh_len = 0,
    mh_data = 0x3d1fd13b "@\002\001?\b>\006l!E",
    mh_type = 0,
    mh_flags = 0
  },
  ....

p *((struct mbuf *) 0x3d221700)
$5 = {
  m_hdr = {
    mh_next = 0x3d221600,
    mh_nextpkt = 0xfffffff7,
    mh_len = -1,
    mh_data = 0xffffffff <Address 0xffffffff out of bounds>,
    mh_type = 0,
    mh_flags = -1
  },

and you're testing if (mbuf_len( ) < 0) ...

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >KPI, mbuf, strange mbuf and mbuf_len strange definition (From: Stephane Sudre <email@hidden>)

  • Prev by Date: KPI, mbuf, strange mbuf and mbuf_len strange definition
  • Next by Date: Re: KPI, mbuf, strange mbuf and mbuf_len strange definition
  • Previous by thread: KPI, mbuf, strange mbuf and mbuf_len strange definition
  • Next by thread: Re: KPI, mbuf, strange mbuf and mbuf_len strange definition
  • Index(es):
    • Date
    • Thread