> + case RDMA_ROUTE:
> + if (*optlen < sizeof(path_data)) {
> + ret = EINVAL;
> + } else {
> + len = 0;
> + opt = optval;
> + path_rec = rs->cm_id->route.path_rec;
> + num_paths = 0;
> + if (len + sizeof(path_data) <= *optlen &&
len is 0 here and we've already checked *optlen
> + num_paths < rs->cm_id->route.num_paths) {
and num_paths is 0
> + rs_convert_sa_path(path_rec,
> &path_data);
> + memcpy(opt, &path_data,
> sizeof(path_data));
> + len += sizeof(path_data);
> + opt += sizeof(path_data);
> + path_rec++;
> + num_paths++;
were you actually wanting a loop here?
> + }
This also needs to handle the case where rgetsockopt is called immediately
after rsetsockopt. Something like:
if (rs->optval) {
memcpy(rs->optval, optval, rs->optlen);
*optlen = rs->optlen;
}
assuming that rs->optlen is verified
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html