On Tue, 2009-01-13 at 15:49 +0200, Jouni Malinen wrote: > On Tue, Jan 13, 2009 at 02:38:57PM +0100, Johannes Berg wrote: > > > kmemdup? Might also make sense to not try the allocation if we're going > > to refuse it anyway, but that might be complicated to do and probably > > doesn't matter. > > I did not know there is such a thing as kmemdup (apparently not that > many other people, either, taken into account it is not used anywhere in > the generic wireless code). Anyway, yes, it would work here. Heh. Yeah, I think it's a fairly recent addition to the API, maybe two years old or so. > Moving the allocation to be done for each subtype separately would add > quite a bit of extra code and error paths. Doing it once resulted in > simpler implementation. The array version was much simpler on this area, > but with separate variables for each subtype, I think it is better to > just allocate (and deal with NULL) once even if we will immediately > after this need to free the buffer in the case the request is going to > be refused. Good point. The only other solution I could come up with was having set_mgmt_extra_ie_sta return a u8 ** and size_t * that are assigned, but that seems too ugly. johannes
Attachment:
signature.asc
Description: This is a digitally signed message part