[ofa-general] RE: [PATCH] rdma_cm: fix port type (fix bug 557)

Sean Hefty sean.hefty at intel.com
Mon Jun 4 11:35:49 PDT 2007


>If next_port is signed int, and is randomized to be negative, it will fail
>accesses to the idr data structure and therefore cause errors in rdma_cm users.

next_port is initialized as follows:

	get_random_bytes(&next_port, sizeof next_port);
	next_port = (next_port % (sysctl_local_port_range[1] -
				  sysctl_local_port_range[0])) +
		    sysctl_local_port_range[0];

Even if next_port is initialized to a negative value by get_random_bytes, I
would expect next_port to be set to a positive value between local_port_range[0]
and local_port_range[1] by the next statement.  I'm not seeing the error my my
math/logic here.

- Sean



More information about the general mailing list