Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S266646AbUFWSzH (ORCPT ); Wed, 23 Jun 2004 14:55:07 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S266644AbUFWSyY (ORCPT ); Wed, 23 Jun 2004 14:54:24 -0400 Received: from mx1.redhat.com ([66.187.233.31]:47806 "EHLO mx1.redhat.com") by vger.kernel.org with ESMTP id S266650AbUFWSvR (ORCPT ); Wed, 23 Jun 2004 14:51:17 -0400 Date: Wed, 23 Jun 2004 11:50:27 -0700 From: "David S. Miller" To: rahul b jain cs student Cc: linux-kernel@vger.kernel.org Subject: Re: Question about ip_rcv() function Message-Id: <20040623115027.11ef0902.davem@redhat.com> In-Reply-To: References: <20040622212403.21346.qmail@lwn.net> X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; sparc-unknown-linux-gnu) X-Face: "_;p5u5aPsO,_Vsx"^v-pEq09'CU4&Dc1$fQExov$62l60cgCc%FnIwD=.UF^a>?5'9Kn[;433QFVV9M..2eN.@4ZWPGbdi<=?[:T>y?SD(R*-3It"Vj:)"dP Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 790 Lines: 23 On Wed, 23 Jun 2004 14:45:47 -0400 (EDT) rahul b jain cs student 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. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/