[ofa-general] [PATCH] IPoIB: check multicast address format

Roland Dreier rdreier at cisco.com
Tue Sep 1 12:45:28 PDT 2009


The idea seems sound but checkpatch.pl gives 6 errors for this small
patch!  Also:

 > +static int check_mcast(const u8 *addr,unsigned int addrlen,
 > +		       const u8 *broadcast)

name of the function could make it clearer what the expected return
value is ... eg mcast_addr_is_valid() or something like that.

 > +	if (addrlen != 20)

We have INFINIBAND_ALEN defined, seems better than a magic # here.

 > +	if (memcmp(addr,broadcast,6) != 0)

Personal taste here, but "if (foo != 0)" always seems silly to me when
we could just do "if (foo)" -- haven't looked at what usage of memcmp()
is more idiomatic in the kernel tho.

 - R.



More information about the general mailing list