Commit Graph

15 Commits

Author SHA1 Message Date
Vitaly Osipov 91d435fe36 staging: rtl8712: remove _malloc()
This patch removes all usage of _malloc() and the function itself. Most
uses are straightforward replacements by kmalloc(..., GFP_ATOMIC),
because this was the definition of _malloc(). In a few places it
was possible to use kzalloc() or memdup_user.

A further improvement would be to replace GFP_ATOMIC with GFP_KERNEL
where possible.

Verified by compilation only.

Initial replacement done by running a Coccinelle script along the lines
of:

@@
type T;
expression E;
identifier V;
@@
- V = (T) _malloc(E);
+ V = kmalloc(E, GFP_ATOMIC);

@@
expression E, E1;
@@
- E1 = _malloc(E);
+ E1 = kmalloc(E, GFP_ATOMIC);

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-25 11:04:44 -07:00
Peter Senna Tschudin 8ffca9eae6 staging: r8712u: Remove useless return variables
This patch remove variables that are initialized with a constant,
are never updated, and are only used as parameter of return.
Return the constant instead of using a variable.

Verified by compilation only.

The coccinelle script that find and fixes this issue is:
// <smpl>
@@
type T;
constant C;
identifier ret;
@@
- T ret = C;
... when != ret
- return ret;
+ return C;
// </smpl>

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 02:17:18 +09:00
Christian Engelmayer 2af9e74ae6 staging: rtl8712: fix potential leaks in r8712_set_key()
Fix potential leaks in the error paths of r8712_set_key(). In case the
algorithm specific checks fail, the function returns without enqueuing
or freeing the already allocated command and parameter structs. Use a
centralized exit path and make sure that all memory is freed correctly.
Detected by Coverity - CID 144370, 144371.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-24 01:57:14 +09:00
Alexandre Demers a762771445 staging r8712u: Remove useless netdev_info slowly polluting dmesg
Remove useless netdev_info slowly flooding dmesg.
Fixes bug https://bugzilla.kernel.org/show_bug.cgi?id=64231

Signed-off-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-25 11:57:53 -08:00
Thomas Cort 77e73e8c90 Staging: rtl8712: fix spaces before semicolons
Resolve all of the 'WARNING: space prohibited before semicolon'
checkpatch warnings for rtl8712.

Signed-off-by: Thomas Cort <linuxgeek@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-03 13:50:54 -07:00
Przemo Firszt 87a573ada0 rtl8712: replace printk with better solutions
Replace printk with netdev_printk helpers, dev_printk helpers or
pr_err/warn/info if there is no device info available.

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-11 16:39:11 -08:00
Cyril Roelandt 0fb3321321 rtl8712: remove useless calls to memset().
These calls are followed by calls to memcpy() on the same memory area, so they
can be safely removed.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-11 16:37:11 -08:00
Wei Yongjun 3cd84fbd66 staging: r8712u: rtl871x_mlme.c: use is_zero_ether_addr() instead of memcmp()
Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is
all zeros.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-04 14:09:02 -07:00
Justin P. Mattock be10ac2b96 staging: rtl8712: Fix typos.
Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-09 13:46:01 -07:00
Julia Lawall 7c19c1e80d drivers/staging/rtl8712/rtl871x_mlme.c: eliminate a null pointer dereference
If ibss_wlan is NULL, it is not correct to memcpy into its field.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
expression E, E1;
identifier f;
statement S1,S2,S3;
@@

if (E == NULL)
{
  ... when != if (E == NULL || ...) S1 else S2
      when != E = E1
*E->f
  ... when any
  return ...;
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 17:19:23 -08:00
Larry Finger 447ff88652 staging: r8712u: Fix possible out-of-bounds index with TKIP and AES keys
Array XGrpKey has only 2 elements and uses (keyid - 1) as the index, which
allows the possibility of memory corruption from an out-of-bounds index.

This problem was reported by a new version of smatch.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-11 10:02:49 -06:00
Ali Bahar ee5b1aadfd staging: r8712u: Merging Realtek's latest (v2.6.6). Various fixes.
In r8712_generate_ie(), HT check is no longer done.
Removed r8712_add_ht_addt_info().
Changes to defragmentation handling, and queue selection.
Get TSSI command.
Added an Ad-Hoc check to is_desired_network()
r8712_ind_disconnect() now checks for Linked state.
r8712_xmit_bh() now schedules an xmit tasklet.

Signed-off-by: Ali Bahar <ali@internetDog.org>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-06 17:00:35 -07:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Larry Finger 2e04fc838a staging: r8712u: Fix potential crash issue
When the driver received the Addba request frame from AP, a crash could
occur.

Signed-off-by: Albert Wang <albert_wang@realtek.com.tw>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-08-31 10:59:53 -07:00
Larry Finger 2865d42c78 staging: r8712u: Add the new driver to the mainline kernel
This code is for a completely new version of the Realtek 8192 USB devices
such as the D-Link DWA-130. The Realtek code, which was originally for
Linux, Windows XP and Windows CE, has been stripped of all code not needed
for Linux. In addition, only one additional configuration variable, which
enables AP mode, remains.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Tested-by: Frederic Leroy <fredo@starox.org>
2010-08-20 10:15:30 -05:00