iwlwifi: mvm: use ksize to memset scan_command
authorDavid Spinadel <david.spinadel@intel.com>
Mon, 2 Jun 2014 06:59:49 +0000 (09:59 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 24 Jun 2014 12:04:14 +0000 (15:04 +0300)
Use ksize to get scan command size instead of calculating it, to
avoid nasty bugs.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/scan.c

index 4b6c7d4bd199ef4dbc20defd15f966e59545d6e3..df8f3ebea84aeb95c35f0f08f6ec024cdfc5e9d6 100644 (file)
@@ -325,9 +325,7 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm,
 
        IWL_DEBUG_SCAN(mvm, "Handling mac80211 scan request\n");
        mvm->scan_status = IWL_MVM_SCAN_OS;
-       memset(cmd, 0, sizeof(struct iwl_scan_cmd) +
-              mvm->fw->ucode_capa.max_probe_length +
-              (MAX_NUM_SCAN_CHANNELS * sizeof(struct iwl_scan_channel)));
+       memset(cmd, 0, ksize(cmd));
 
        cmd->channel_count = (u8)req->n_channels;
        cmd->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME);