Commit Graph

1924 Commits

Author SHA1 Message Date
Ajay Singh
b00e2fd104 staging: wilc1000: fix NULL pointer exception in host_int_parse_assoc_resp_info()
Commit fe014d4e6b (staging: wilc1000: free memory allocated for general info
message from firmware) introduced a bug by using wrong source address in
kmemdup(). 'conn_info.req_ies' is used for source address in kempdup()
instead of 'hif_drv->usr_conn_req.ies'.

This commit fixes the NULL pointer dereference issue in
host_int_parse_assoc_resp_info() by using the correct source address in
kmemdup().

Fixes: fe014d4e6b (staging: wilc1000: free memory allocated for general info message from firmware)
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:57:38 +02:00
Fengguang Wu
291b93ca2c staging: wilc1000: fix memdup.cocci warnings
drivers/staging/wilc1000/host_interface.c:946:32-39: WARNING opportunity for kmemdup
drivers/staging/wilc1000/host_interface.c:970:30-37: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: aaea2164bd ("staging: wilc1000: check for kmalloc allocation failures")
CC: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:39:21 +02:00
HariPrasath Elango
2415fa8f94 staging: wilc1000: remove unused return variable
In this function,removed the unused integer variable as it is not
actually used to return function success or failure. Return is a pointer
to net_device structure.

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:39:21 +02:00
Ajay Singh
fe014d4e6b staging: wilc1000: free memory allocated for general info message from firmware
Free allocated memory for failure scenario while processing the
information message received from the firmware. Added NULL check and used
kmemdup in the flow of handling information message.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:47 +02:00
Ajay Singh
158152be0a staging: wilc1000: split handle_rcvd_gnrl_async_info() to avoid leading tabs
Fix 'Too many leading tabs' issue found by checkpatch.pl script in
handle_rcvd_gnrl_async_info().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:47 +02:00
Ajay Singh
3b5f10dbea staging: wilc1000: free allocated memory in wilc_add_rx_gtk()
Free memory allocated in wilc_add_rx_gtk() before returing from the
function.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:47 +02:00
Ajay Singh
2dc916f48c staging: wilc1000: fix to free allocated memory in wilc_add_ptk()
Free allocated memory in wilc_add_ptk() when it fails to enqueue the
command.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:47 +02:00
Ajay Singh
8d5b5e6a26 staging: wilc1000: free allocated memory after processing wilc_send_config_pkt()
Free allocated memory after completing wilc_send_config_pkt() function.
Remove unncessary use of 'stamac' pointer in handle_get_inactive_time().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:47 +02:00
Ajay Singh
c26bdea4e7 staging: wilc1000: free memory allocated in add wep key functions
Free memory allocated for wep key when command enqueue is failed.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:46 +02:00
Ajay Singh
7ab3e668aa staging: wilc1000: free allocated memory in edit and add station functions
Added fix to free the allocated memory in case of failure to enqueue
the command.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:38:46 +02:00
Ajay Singh
25b951332d staging: wilc1000: avoid 'NULL' pointer access in wilc_network_info_received()
Added 'NULL' check before accessing the allocated memory. Free up the
memory incase of failure to enqueue the command. Used kmemdup instead of
kmalloc & memcpy.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:37:09 +02:00
Ajay Singh
56294f8714 staging: wilc1000: remove unused global variables related to p2p
Cleanup patch to remove the unused global variables defined for p2p.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:37:09 +02:00
Colin Ian King
aaea2164bd staging: wilc1000: check for kmalloc allocation failures
There are three kmalloc allocations that are not null checked which
potentially could lead to null pointer dereference issues. Fix this
by adding null pointer return checks.

Detected by CoverityScan, CID#1466025-27 ("Dereference null return")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 18:23:10 +01:00
HariPrasath Elango
a0e8045e6e staging: wilc1000: replace switch statement by simple if condition
In this case,there is only a single switch case statement.So replacing
by a simple if condition

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 18:23:10 +01:00
HariPrasath Elango
2ebd9ec4ac staging: wilc1000: destroy initialized mutex object
A mutex object that is initialized but not destroyed.This patch destroys
the mutex object

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:45:31 +01:00
HariPrasath Elango
3ea60ab5fa staging: wilc1000: use kmemdup instead of kmalloc and memcpy
Kmalloc followed by memcpy can be replaced by kmemdup.

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:45:31 +01:00
HariPrasath Elango
50413119b6 staging: wilc1000: Destroy mutex object in deinitialization
Destroy the mutex object that is initialized in wlan_init_locks()

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:45:31 +01:00
HariPrasath Elango
76c01fdd82 staging: wilc1000: Fix code block alignment
Fix the code alignment for a block of code to adhere to coding
guidelines

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:45:31 +01:00
Ajay Singh
d3127c7a7c staging: wilc1000: fix line over 80 char issue in handle_scan_done()
Fix 'line over 80 characters' issue found by checkpatch.pl script in
handle_scan_done().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
f3a46b0fcc staging: wilc1000: rename variables using camelCase in handle_rcvd_gnrl_async_info()
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
88be64aad1 staging: wilc1000: rename WILC_HostIf_PackStaParam to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
d956839de0 staging: wilc1000: rename variables prefix using datatype 'u8'
Rename variables with datatype 'u8' in their name to follow the linux
coding style.

Renamed following variables:
u8abort_running_scan
pu8Buffer
pu8keybuf
pu8msa
u8remain_on_chan_flag

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
0e7ba8eb97 staging: wilc1000: fix line over 80 character in handle_disconnect()
Refactor handle_disconnect() to avoid line over 80 characters issue
reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
54300bfb88 staging: wilc1000: fix line over 80 char in handle_connect()
Fix 'line over 80 characters' issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
03ed9089cb staging: wilc1000: fix line over 80 char in handle_scan()
Fix 'line over 80 character' issue reported by checkpatch.pl script in
handle_scan().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
3e488a958a staging: wilc1000: rename label 'ERRORHANDLER' to avoid uppercase name
Cleanup patch to avoid use of uppercase for label names, to follow linux
coding style.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
f32aeb0ecd staging: wilc1000: rename strConnectInfo to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
ec90c21b46 staging: wilc1000: rename pstrHostIFconnectAttr to avoid camelCase issue
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:51 +01:00
Ajay Singh
648cd9a69e staging: wilc1000: fix line over 80 char in cfg_scan_result()
Refactor cfg_scan_result() API to avoid 'line over 80 chars' issue
reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
7d61592731 staging: wilc1000: rename pJoinParams to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
a15b48bebf staging: wilc1000: fix line over 80 char in mgmt_tx_cancel_wait()
Fix 'line over 80 char' issue found in checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
0a0dac38d4 staging: wilc1000: fix line over 80 char for cfg parse RX and TX function
Fix 'line over 80 characters' issue found by checkpatch.pl script. Moved
the common code from wilc_wfi_cfg_parse_tx_action() &
wilc_wfi_cfg_parse_rx_action() to new function to avoid checkpatch issue.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
6fa02f2d0b staging: wilc1000: fix line over 80 char in get_key() & set_default_key()
Fix 'line over 80 characters' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
f3a5aa287e staging: wilc1000: fix line over 80 char in change_virtual_intf()
Fix 'line over 80 char' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
228f3cdb01 staging: wilc1000: rename au8ScanChanList to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
a0e317cf92 staging: wilc1000: rename CfgScanResult to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
09c65f7bde staging: wilc1000: rename pstrNetworkInfo to avoid camelCase
Fix 'Avoid camleCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
02567aa6e1 staging: wilc1000: rename strHiddenNetwork to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:59:04 +01:00
Ajay Singh
e7893674d6 staging: wilc1000: rename u16DummyReasonCode to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:44 -08:00
Ajay Singh
3b9ccd3bdb staging: wilc1000: fix line over 80 char in handle_rcvd_ntwrk_info()
Fix 'line over 80 character' issues found by checkpatch.pl script by
use of temporary variable and avoided leading tab.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:44 -08:00
Ajay Singh
87ae3a5bd1 staging: wilc1000: rename handle_connect_timeout() variables to avoid camelCase
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:44 -08:00
Ajay Singh
697346817e staging: wilc1000: fix line over 80 char in wilc_scan_complete_received()
Fix 'line over 80 character' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
fab6b72344 staging: wilc1000: fix line over 80 char in wilc_del_allstation() & wilc_deinit()
Fix 'line over 80 characters' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
83ff39d99b staging: wilc1000: fix line over 80 char in wilc_add_ptk()
Fix 'line over 80 characters' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
8007f00092 staging: wilc1000: rename pstrHostIFkeyAttr to avoid camelCase issue
Fix 'Avoid camelCase' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
172148b8ba staging: wilc1000: fix line over 80 char in host_int_parse_join_bss_param()
Fix 'line over 80 characters' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
4262d2fc07 staging: wilc1000: fix line over 80 char for wilc_gnrl_async_info_received()
Fix 'line over 80 char' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
05141a62bb staging: wilc1000: fix line over 80 char in wilc_network_info_received()
Fix 'line over 80 character' issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
2f90a5da7c staging: wilc1000: fix line over 80 char in handle_cfg_param()
Fix 'line over 80 char' issues found by checkpatch.pl script in
handle_cfg_param(). Rename variables and used temporary variables
to fix the line over 80 characters issue.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00
Ajay Singh
38b39d3240 staging: wilc1000: remove always 'true' check from 'if' statement
Fix few smatch warning related to 'warn: always true condition'.

handle_cfg_param() warn: always true condition
'(cfg_param_attr->auth_timeout < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->rts_threshold < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->beacon_interval < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->site_survey_scan_time < 65536) => (0-u16max <
65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->active_scan_time < 65536) => (0-u16max < 65536)'
handle_cfg_param() warn: always true condition
'(cfg_param_attr->passive_scan_time < 65536) => (0-u16max < 65536)'

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:11:43 -08:00