netdev
[Top] [All Lists]

Re: Patch: minor nit in ip_options_compile()

To: niv@xxxxxxxxxx (Nivedita Singhvi)
Subject: Re: Patch: minor nit in ip_options_compile()
From: kuznet@xxxxxxxxxxxxx
Date: Mon, 24 Mar 2003 03:02:13 +0300 (MSK)
Cc: davem@xxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <200303211956.50921.niv@xxxxxxxxxx> from "Nivedita Singhvi" at Mar 21, 3 07:56:50 pm
Sender: netdev-bounce@xxxxxxxxxxx
Hello!

> In the following else clause, we check for opt->is_data, which=20
> should always be set for this case, and if not, current code will
> lead to a null ptr dereference because skb is always null in=20
> this case..

You misunderstood tha code. If opt->is_data is clear skb may be not NULL.
The option is not used at the moment, but it it pretty silly to lose this.

> Look reasonable?=20

No:

> +=09=09if ((optptr =3D opt->__data) =3D=3D 0)
> +=09=09=09goto error;=20

is identical FALSE. [Sent quatable-printable attachment? Get it
back quoted. :-)]


> Figured its better to fall down to returning EINVAL..

if (skb == NULL)
   BUG();

Listen, I love to add BUG()s when it is not mathematically
clear that something is invariant. Not in this trivial case.

Alexey

<Prev in Thread] Current Thread [Next in Thread>