[illumos-Developer] webrev: 696 Incorrect check dma_attr_sgllen <= 0 in rootnex_valid_alloc_parms
Garrett D'Amore
garrett at damore.org
Fri May 6 21:56:25 PDT 2011
696 Incorrect check dma_attr_sgllen <= 0 in rootnex_valid_alloc_parms
http://mexico.purplecow.org/gdamore/webrev/sgllen/
This fixes the infinite list length (-1) problem in rootnex. We first
noted that this code caused problems in DEBUG kernels, but it turns out
that its far worse than that. The code also takes a slow code path, or
just fails to map entirely, on all kernels. (This explains some other
bizarre behavior I've seen before.)
So, we now properly support the documented use of -1 to indicate no
limit on the length of the s/g list for DMA.
I know some will complain about the use of the casts, but I think this
is the simplest solution and most efficient, to the problem. (We can't
change the type, I'd prefer not to change the caller's structure
directly, I don't like adding extra tests, and even a simple mask
operation will add more cpu cycles without really adding any additional
value.)
To answer another question, si_sgl_size is unsigned, so the compares
where I cast to an integer are all against another unsigned value, so
this shouldn't be a concern. :-)
I've tested this code using a modified e1000g (modified for this test)
that uses -1 as the sgllen (on a debug kernel) and it seems to be OK.
In fact, I'm running that code now. :-)
- Garrett
More information about the Developer
mailing list