All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David S. Miller" <davem@redhat.com>
To: rahul b jain cs student <rbj2@oak.njit.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question about ip_rcv() function
Date: Wed, 23 Jun 2004 11:50:27 -0700	[thread overview]
Message-ID: <20040623115027.11ef0902.davem@redhat.com> (raw)
In-Reply-To: <Pine.GSO.4.58.0406231441500.7099@chrome.njit.edu>

On Wed, 23 Jun 2004 14:45:47 -0400 (EDT)
rahul b jain cs student <rbj2@oak.njit.edu> wrote:

> can anyone explain what is the difference between the following two pieces
> of code.
> 
> 1. if (!pskb_may_pull(skb, sizeof(struct iphdr)))
>                 goto inhdr_error;
> 
>    iph = skb->nh.iph;
> 
> 2. if (!pskb_may_pull(skb, iph->ihl*4))
>                 goto inhdr_error;
> 
>    iph = skb->nh.iph;

We can't dereference any of the iphdr fields (such as iph->ihl) until
we know that at least "sizeof(struct iphdr)" bytes are there first.

  reply	other threads:[~2004-06-23 18:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22 20:48 sk_buff structure rahul b jain cs student
2004-06-22 21:24 ` Jonathan Corbet
2004-06-22 23:03   ` rahul b jain cs student
2004-06-23 18:45   ` Question about ip_rcv() function rahul b jain cs student
2004-06-23 18:50     ` David S. Miller [this message]
2004-06-23 20:22       ` rahul b jain cs student
2004-06-23 20:32         ` David S. Miller
2004-06-23 20:43           ` rahul b jain cs student

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040623115027.11ef0902.davem@redhat.com \
    --to=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rbj2@oak.njit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.