[openib-general] [PATCH 2/13] osm: port to WinIB stack : opensm/osm_prtn_config.c

Michael S. Tsirkin mst at mellanox.co.il
Sun Sep 17 10:34:08 PDT 2006


Quoting r. Eitan Zahavi <eitan at mellanox.co.il>:
> @@ -112,7 +101,7 @@ static int partition_create(unsigned lin
>  
>  	if (id) {
>  		char *end;
> -		pkey = strtoul(id, &end, 0);
> +		pkey = (uint16_t)strtoul(id, &end, 0);
>  		if (end == id || *end)
>  			return -1;
>  	} else

would it make sense to range-check the value before casting it?

-- 
MST




More information about the general mailing list