Actually, I take that back. If 'sg' is the last entry in a *non*linked
scatter-gather list (ie we don't use the last entry as a link, we actually
use it as a real SG entry), then "sg_next(sg)" will indeed access past the
end of the whole allocated array, and will access one past the end.
And with page-alloc debugging, that *will* blow up.
So I think your change to use "sg_next()" only when you actually need a
next pointer is the correct one after all.
Linus
-