[Openib-windows] a sanity check for Modify CA verb

Fabian Tillier ftillier at silverstorm.com
Mon Sep 11 10:12:13 PDT 2006


Hi Leo,

On 9/11/06, Leonid Keller <leonid at mellanox.co.il> wrote:
>
> A little patch, adding a sanity check for Modify CA verb
>
> Index: core/al/al_ca.c
> ===================================================================
> --- core/al/al_ca.c (revision 487)
> +++ core/al/al_ca.c (working copy)
> @@ -305,6 +305,11 @@
>    AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
> ("IB_INVALID_PARAMETER\n") );
>    return IB_INVALID_PARAMETER;
>   }
> + if (ca_mod > IB_CA_MOD_LAST_OPTION)

You can't do this check, as ca_mod is a bitfield that can have more
than one bit set.  The highest value is the OR of every other option.
It would probably be better to check the reserved bits (create a mask
of reserved bits - 0xFF000000 currently) and fail the call if any of
the reserved bits are set.  That is, ca_mod & MASK should be zero.

I commited a fix for this in revision 490.

Thanks,

- Fab




More information about the ofw mailing list