Based on the code _before_ this hunk, I believe this patch to be wrong(the goto out matches):

/* If we have something to return to the user */ if (!err && IW_IS_GET(cmd)) { /* Check if there is enough buffer up there */ if (user_length < iwp->length) { err = -E2BIG; goto out; }

Thus, apparently drivers were intended to be allowed to return moreinformation than userspace had allocated space for (which also matchesthe initial extra_size calculation in this function), so your comment iswrong, and your check is also wrong because you actually put the burdenon the driver, contrary to the apparent intention of this code.

I believe the below patch is a much better fix as it allows the -E2BIGcode path to be invoked which is more informative to users thantruncated information (which, in your code, may even be truncated in themiddle of a token!!)