out_list_err:
-       rc = PTR_ERR(f->fr_pgl);
+       rc = -ENOMEM;
        dprintk("RPC:       %s: ib_alloc_fast_reg_page_list status %i\n”,

Should you update this debugging message?

Yes I will.

+       n = ib_map_mr_sg(mr, frmr->sg, frmr->sg_nents, PAGE_SIZE);
+       if (unlikely(n != frmr->sg_nents)) {

The basic logic looks OK. But signed v. unsigned comparison here?
Is there a guarantee that the maximum value sg_nents can have is
INT_MAX?

i and n are signed, sg_nents is unsigned. I’d prefer to have
the variable signage all agree. Since we’re counting stuff,
maybe unsigned all around is a better choice? (rc should
remain signed).

OK, I'll make i, n, len unsigned integers.


If ib_map_mr_sg can return a negative value, maybe “rc = ib_map_mr_sg”
is more clear. Is n used anywhere else?

Nop.


Use %u formatter for displaying unsigned variables.


+               pr_err("RPC:       %s: failed to map mr %p (%d/%d)\n",
+                      __func__, frmr->fr_mr, n, frmr->sg_nents);
+               rc = n < 0 ? n : -EINVAL;
+               goto out_senderr;

Is frmr->sg_nents set correctly here for the ib_dma_unmap_sg()
call in the error exit? Maybe you want to use the value in
“n” instead (as long as it’s positive, of course).

Umm, I think that frmr->sg_nents is assigned before the unmap is even
reachable (we assign before mapping because we won't take partial
maapings at least for now).



I'll be waiting for more comments before posting v4.

Cheers,
Sagi.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to