netdev
[Top] [All Lists]

Re: [PATCH] PKT_SCHED: validate policer configuration TLVs

To: Thomas Graf <tgraf@xxxxxxx>
Subject: Re: [PATCH] PKT_SCHED: validate policer configuration TLVs
From: "David S. Miller" <davem@xxxxxxxxxxxxx>
Date: Tue, 7 Dec 2004 21:32:34 -0800
Cc: netdev@xxxxxxxxxxx
In-reply-to: <20041207172349.GG1371@postel.suug.ch>
References: <20041207172349.GG1371@postel.suug.ch>
Sender: netdev-bounce@xxxxxxxxxxx
On Tue, 7 Dec 2004 18:23:49 +0100
Thomas Graf <tgraf@xxxxxxx> wrote:

> Adds TLV size sanity checks for policer configuration. 

Hmmm...

> -     if (tb[TCA_POLICE_RESULT-1])
> +     if (tb[TCA_POLICE_RESULT-1]) {
> +             if (RTA_PAYLOAD(tb[TCA_POLICE_RESULT-1]) != sizeof(u32))
> +                     goto failure;
>               p->result = *(int*)RTA_DATA(tb[TCA_POLICE_RESULT-1]);
> +     }

Either these things are int's or u32's, they cannot be both :-)
I know that size wise it's identical, but at least make the code
look consistent.

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