fa.netbsd.tech.kern
[Top] [All Lists]

Re: Possible mermory corruption in if_msk.c?

Subject: Re: Possible mermory corruption in if_msk.c?
From: "Marco Trillo" <marcotrillo@xxxxxxxxx>
Date: Tue, 15 Jul 2008 22:16:31 UTC
Newsgroups: fa.netbsd.tech.kern

Hi,

On Tue, Jul 15, 2008 at 11:07 PM, Anthony Mallet
<anthony.mallet@xxxxxxxxxxxxxxxxx> wrote:
> I inspected a bit the if_msk.c code. Maybe I overlooked something but I
> have the feeling that there is an inconsistency between the declaration
> of :
>
> struct sk_chain_data in if_skvar.h:114:
>
> struct sk_chain_data {
>        [...]
>        void *                  sk_jslots[SK_JSLOTS];
>        [...]
> };
>
> and initialization of this array in if_msk.c:601
>
>        for (i = 0; i < MSK_JSLOTS; i++) {
>                sc_if->sk_cdata.sk_jslots[i] = ptr;
>
> SK_JSLOTS is defined to 384 but MSK_JSLOTS is defined by a (magic?)
> formula that evaluates to 768.

Hmm... it's not using the definitions from if_skvar.h but rather from
if_mskvar.h which are defined as follows:

struct msk_chain_data {
[...]
        void *                  sk_jslots[MSK_JSLOTS];
[...]
};

/* Softc for each logical interface */
struct sk_if_softc {
[...]
        struct msk_chain_data   sk_cdata;
        struct msk_ring_data    *sk_rdata;
[...]
};

So it looks correct to me.

Regards,
Marco

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