Search Linux Wireless

Re: [RFCv2 12/13] cfg80211: add channel checking for iface combinations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg wrote:
On Wed, 2012-06-20 at 08:14 +0200, Michal Kazior wrote:

+		case CHAN_MODE_SHARED:
+			for (i = 0; i<  num_max_channels; i++)
+				if (!used_channels[i] || used_channels[i] == ch)
+					break;
+
+			if (i == num_max_channels) {
+				kfree(used_channels);
+				return -ENOMEM;
+			}

Maybe use -EBUSY? -ENOMEM doesn't seem to make much sense? Or maybe I'm
misunderstanding that? You allocated a pretty large number before (one
for each possible channel) so we can't really run into it anyway I
think?

Or ... maybe we should just do something like

  * force num_different_channels to be less than a constant we define,
    say #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10 by checking in
    wiphy registration -- if somebody needs more .... they can change
    the constant but that seems very unlikely
  * use a channel array with that size on the stack here, then we don't
    even need to alloc memory

I just get too generic sometimes. Sounds good to me.


--
Pozdrawiam / Best regards, Michal Kazior.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux