On Tue, Oct 29, 2013 at 1:06 PM, Dan Carpenter <[email protected]> wrote:
> You and James are right. It should be checking against the sizeof().
> I will send a v2 tomorrow. Sorry about that.
Looking some more at this, I have to say that I absolutely detest
those aacraid structures. And I'm not sure that sizeof() is
necessarily the right thing for the minimum size.
The "struct user_aac_srb" includes a
struct user_sgmap sg;
which has a count in it. But the actual "struct user_sgmap" structure
is defined with a
struct user_sgentry sg[1];
in it, so the sizeof() of that structure basically gives the size of
an entry that has _one_ sgentry.
And it's not entirely clear that you absolutely have to have a minimum
of one sgentry. So I could imagine that there would be a zero-entry
case that doesn't have any scatter-gather entries at all (ie just the
status parts). So the "sizeof()" might actually end up giving a
minimum size that is too large *if* it is possible to not have those
scatter-gather entries at all?
Hmm? Somebody who knows this code, please speak up..
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html