summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
AgeCommit message (Collapse)AuthorFilesLines
2023-10-15staging: rtl8192u: Remove broken driverPhilipp Hortmann1-2430/+0
Tests on rtl8192u hardware have shown that this driver is broken since 2016. Remove broken driver. Find fix for two bugs in second link. Link: https://lore.kernel.org/lkml/db98d9ac-7650-4a72-8eb9-4def1f17ea0d@app.fastmail.com/ Link: https://lore.kernel.org/lkml/cover.1697089416.git.philipp.g.hortmann@gmail.com/ Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20231014211051.GA29518@matrix-ESPRIMO-P710 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-27staging: rtl8192u: Fix keyidx assignment within if conditionWang Jinchao1-4/+6
Refactor the if condition into nested conditionals to improve clarity. The condition is currently in the form of (E1 && E2 && E3), where the variable keyidx is assigned a value in E3. Signed-off-by: Wang Jinchao <wangjinchao600@gmail.com> Link: https://lore.kernel.org/r/ZKQ7tYa9I+PHgef/@fedora Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-25staging: rtl8192u: remove unused ieee80211_SignalStrengthTranslate functionTom Rix1-38/+0
clang with W=1 reports drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:1961:18: error: unused function 'ieee80211_SignalStrengthTranslate' [-Werror,-Wunused-function] static inline u8 ieee80211_SignalStrengthTranslate( ^ This function is not used so remove it. It may have been used in the past but that has been commented out. Also remove the comment. Signed-off-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20230323165931.2634587-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-12-05staging: rtl8192u: Fix use after free in ieee80211_rx()Dan Carpenter1-1/+3
We cannot dereference the "skb" pointer after calling ieee80211_monitor_rx(), because it is a use after free. Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/Y33BArx3k/aw6yv/@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-20staging: rtl8192u: Fix spelling mistake athros -> Atheros and fix grammerColin Ian King1-1/+1
There is a spellig mistake, correct it and fix capital letter on the proper noun. Also fix the grammar. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20221004150944.148157-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-10staging: rtl8192u: Avoid field-overflowing memcpy()Kees Cook1-35/+14
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Split the 3 addr memcpy() into 3 memcpy() calls so the compiler doesn't think an overflowing memcpy() happens against the addr1 field (the neighbors are intended to be copied as well). ieee80211_read_qos_param_element() copies a struct ieee80211_info_element into a struct ieee80211_qos_information_element, but is actually wanting to copy into the larger struct ieee80211_qos_parameter_info (the contents of ac_params_record[] is later examined). Refactor the routine to perform centralized checks, and copy the entire contents directly (since the id and len members match the elementID and length members): struct ieee80211_info_element { u8 id; u8 len; u8 data[]; } __packed; struct ieee80211_qos_information_element { u8 elementID; u8 length; u8 qui[QOS_OUI_LEN]; u8 qui_type; u8 qui_subtype; u8 version; u8 ac_info; } __packed; struct ieee80211_qos_parameter_info { struct ieee80211_qos_information_element info_element; u8 reserved; struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; } __packed; Additionally replace old-style zero-element arrays with flexible arrays. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Pascal Terjan <pterjan@google.com> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210806201208.2871467-1-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-12staging: rtl8192u: ieee80211: Remove braces for single line blocksAtul Gopinathan1-24/+18
Remove braces around those `if` and `for` blocks which contain a single line and therefore fix the Checkpatch warning of the following type: "WARNING: braces {} are not necessary for single statement blocks" Signed-off-by: Atul Gopinathan <atulgopinathan@gmail.com> Link: https://lore.kernel.org/r/20210310104353.14531-1-atulgopinathan@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-18staging: rtl8192u: Do not use GFP_KERNEL in atomic contextChristophe JAILLET1-1/+1
'rtl8192_irq_rx_tasklet()' is a tasklet initialized in 'rtl8192_init_priv_task()'. >From this function it is possible to allocate some memory with the GFP_KERNEL flag, which is not allowed in the atomic context of a tasklet. Use GFP_ATOMIC instead. The call chain is: rtl8192_irq_rx_tasklet (in r8192U_core.c) --> rtl8192_rx_nomal (in r8192U_core.c) --> ieee80211_rx (in ieee80211/ieee80211_rx.c) --> RxReorderIndicatePacket (in ieee80211/ieee80211_rx.c) Fixes: 79a5ccd97209 ("staging: rtl8192u: fix large frame size compiler warning") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20200813173458.758284-1-christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19staging: rtl8192u: Merge almost duplicate codePascal Terjan1-77/+49
This causes a change in behaviour: - stats also get updated when reordering, this seems like it should be the case but those lines were commented out. - sub_skb NULL check now happens early in both cases, previously it happened only after dereferencing it 12 times, so it may not actually be needed. Signed-off-by: Pascal Terjan <pterjan@google.com> Link: https://lore.kernel.org/r/20200519150042.199690-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-15staging: rtl8192u: replace printk with natdev_<LEVEL> statements in ieee80211Paulo Miguel Almeida1-32/+30
Checkpatch reports 'WARNING: printk() should include KERN_<LEVEL> facility level'. Fix this by specifying a relevant KERN_<LEVEL> value for each line in which it was missing. Once they are fixed, checkpatch reports 'WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...'. Fix this by replacing relevant printk_<level> statements with their netdev_<level> equivalent. Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com> Link: https://lore.kernel.org/r/20200115101208.GA683742@localhost.localdomain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-30staging: rtl8192u: ieee80211: Replace snprintf with scnprintfRohit Sarkar1-2/+2
When the number of bytes to be printed exceeds the limit snprintf returns the number of bytes that would have been printed (if there was no truncation). This might cause issues, hence use scnprintf which returns the actual number of bytes printed to buffer always. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Link: https://lore.kernel.org/r/20190910182415.GA5768@SARKAR Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-28staging: rtl8192u: Fix indentationStephen Brennan1-56/+56
Checkpatch reports WARNING:SUSPECT_CODE_INDENT in several places. Fix this by aligning code properly with tabs. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190828043542.3753-1-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21staging: rtl8192u: fix spacing in ieee80211Stephen Brennan1-1/+1
Checkpatch emits several errors, warnings, and checks about spacing. Apply checkpatch's suggested spacing rules. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190821143540.4501-4-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21staging: rtl8192u: fix OPEN_BRACE errors in ieee80211Stephen Brennan1-76/+40
Checkpatch emits several errors regarding braces being on the incorrect line. These can be fixed by moving the brace, do this. In a few cases, some comments were moved to facilitate this. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190821143540.4501-2-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-12staging: rtl8192u: fix spacing errorsStephen Brennan1-255/+200
Used checkpatch's --fix-inplace option for types SPACING, OPEN_BRACE, ELSE_AFTER_BRACE. Manually edited the resulting changes to correct for mistaken fixes and complete fixes that were only partially applied. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190811225120.7308-1-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Use !x in place of NULL comparisonsPuranjay Mohan1-7/+7
Fix the following checkpatch.pl warning : CHECK: Comparison to NULL could be written "!x" by changing (x == NULL) to !x and (x != NULL) to x. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Add spaces around '&&' operatorPuranjay Mohan1-7/+7
Fix coding style errors by adding spaces around '&&' operators. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Fix spelling mistakePuranjay Mohan1-2/+2
Correct spelling mistakes at two places in comments. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Fix coding style warningPuranjay Mohan1-2/+1
Remove braces around a single if statement to fix following checkpatch.pl warning. WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03staging: rtl8192u: add proper SPDX identifiers on files that did not have them.Greg Kroah-Hartman1-5/+1
There were a few files for the rtl8192u driver that did not have SPDX identifiers on them, so fix that up. At the same time, remove the "free form" text that specified the license of the file, as that is impossible for any tool to properly parse. Cc: John Whitmore <johnfwhitmore@gmail.com> Cc: Bhanusree Pola <bhanusreemahesh@gmail.com> Cc: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Cc: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02staging: rtl8192u: ieee80211: ieee80211_rx.c: Replace bit shifting with BIT ↵Payal Kshirsagar1-16/+16
macro Challenge suggested by coccinelle. Prefer using BIT and replace bit shifting with the BIT(x) macro. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-29staging: rtl8192u: ieee80211: Use !x in place of NULL comparisonVatsala Narang1-7/+6
Change NULL comparison to Boolean negation.Issue found using Coccinelle Semantic patch used to solve the problem is as follows: @replace_rule@ expression e; @@ - e == NULL + !e Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-21staging: rtl8192u: ieee80211: ieee80211_rx.c: Remove unnecessary braces.Sanjana Sanikommu1-2/+1
Remove braces around single statement block. Issue found by checkpatch.pl WARNING: braces {} are not necessary for a single statement block Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-20staging: rtl8192u: ieee80211: ieee80211_rx.c: Fix NULL comparisions.Sanjana Sanikommu1-2/+2
Replace NULL comparisons in the file. Issue found by checkpatch.pl Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8192u: Adjust 'if' to follow Kernel coding StyleBhanusree Pola1-8/+2
-Adjust spaces around if and the condition expression to maintain Linux Kernel Coding style. -Remove unnecessary braces around if-else as only single statement is executed. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8192u: Remove casts on the return values of list_entryBhanusree Pola1-4/+4
Remove casts return values of on all occurances of list_entry. Casts on the return values of list_entry are useless. list_entry is a macro and already casts its return value to the type mentioned in its second argument. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8192u: Remove typedef for struct _RX_REORDER_ENTRYBhanusree Pola1-6/+6
-Avoid typedefs for structure types to maintain kernel coding style. -Remove typedefs RX_REORDER_ENTRY and *PRX_REORDER_ENTRY of struct _RX_REORDER_ENTRY . -Change Structure name _RX_REORDER_ENTRY to rx_reorder_entry to maintain Linux kernel Coding Style. -Replace occurences of RX_REORDER_ENTRY to struct rx_reorder_entry. -Replace occurences of PRX_REORDER_ENTRY to struct rx_reorder_entry *. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Rename sHTCLng - StyleJohn Whitmore1-1/+1
The constant sHTCLng causes a checkpatch issue, due to its use of CamelCase naming. To correct the issue the constant has been renamed to HTCLNG. I'm not sure this is a good name as it communicates very little and contradicts the block comment above its definition. MCS_LEN might be a better name if the block comment is correct. Additionally the block comment has been changed to the recommended style. This is a coding style change which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Rename IsLegalChannel - StyleJohn Whitmore1-3/+3
The function IsLegalChannel causes a checkpatch issue due to its use of CamelCase naming. The function has been renamed to is_legal_channel. This is a coding style change which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Rename Dot11d_UpdateCountryIe - StyleJohn Whitmore1-1/+1
The function Dot11d_UpdateCountryIe causes a checkpatch issue due to its use of CamelCase naming, the function has been renamed to dot11d_update_country_ie. This is a coding style change which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Remove macro cpMacAddr - StyleJohn Whitmore1-1/+1
The macro cpMacAddr implements the same functionality as the ether_addr_copy function defined in etherdevice.h, as a result the macro has been removed from the code, and its use replaced with the function call. Note that the header comment of the function ether_addr_copy states that the two byte arrays passed as parameters to the function must be u16 aligned. Because of this the structure ieee80211_network has had its member variables re-ordered so that the members bssid and MBssid are aligned to a u16 boundary. This is a coding style change which should have no impact on runtime code execution. Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxLastFragNum - StyleJohn Whitmore1-3/+3
Rename the member variable RxLastFragNum to rx_last_frag_num. This change clears the checkpatch issue with CamelCase naming. The resulting edits are all coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxLastSeqNum - StyleJohn Whitmore1-3/+3
Rename the member variable RxLastSeqNum to rx_last_seq_num. This change clears the checkpatch issue with CamelCase naming. The resulting changes are purely coding style in nature so should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxPktPendingTimer - StyleJohn Whitmore1-5/+5
Rename the member variable RxPktPendingTimer to rx_pkt_pending_timer. This change clears the checkpatch issue with CamelCase naming. The resulting changes are coding style changes in nature so should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxPendingPktList - StyleJohn Whitmore1-4/+4
Rename the member variable RxPendingPktList to rx_pending_pkt_list. This change resolves the checkpatch issue with CamelCase naming. The resulting changes are purely coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxTimeoutIndicateSeq _StyleJohn Whitmore1-3/+3
Rename member variable RxTimeoutIndicateSeq to rx_timeout_indicate_seq. This change clears the checkpatch issue with CamelCase naming. The resulting changes are purely coding style in nature and should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxIndicateSeq - StyleJohn Whitmore1-20/+20
Rename the member variable RxIndicateSeq to rx_indicate_seq. This change clears the checkpatch issue with CamelCase naming. The resulting changes are purely coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Remove typedef and rename RX_TS_RECORD - StyleJohn Whitmore1-4/+4
Remove the typedef from structure RX_TS_RECORD, this change clears the checkpatch issue with creation of new types. Additionally the structure is renamed from RX_TS_RECORD to rx_ts_record. Whilst this is not raised as a checkpatch error structures are meant to be named in lower case. These changes are coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21staging:rtl8192u: remove typedef of struct TS_COMMON_INFO - StyleJohn Whitmore1-2/+2
To clear a checkpatch issue removed the typedef of the structure TS_COMMON_INFO. This change removes the previous declaration, which defined two types, both TS_COMMON_INFO and a pointer type PTS_COMMON_INFO: typedef struct _TS_COMMON_INFO { ... } TS_COMMON_INFO, *PTS_COMMON_INFO; The pointer type has been completely removed from the code, as: "(so-called Hungarian notation) is brain damaged" according to the coding standard. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-17staging: rtl8192u: remove redundant variablesKenneth Lu1-2/+0
Clean up W=1 warning: variable set but not used. Signed-off-by: Kenneth Lu <kuohsianglu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-13treewide: kmalloc() -> kmalloc_array()Kees Cook1-2/+3
The kmalloc() function has a 2-factor argument form, kmalloc_array(). This patch replaces cases of: kmalloc(a * b, gfp) with: kmalloc_array(a * b, gfp) as well as handling cases of: kmalloc(a * b * c, gfp) with: kmalloc(array3_size(a, b, c), gfp) as it's slightly less ugly than: kmalloc_array(array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: kmalloc(4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. The tools/ directory was manually excluded, since it has its own implementation of kmalloc(). The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ type TYPE; expression THING, E; @@ ( kmalloc( - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | kmalloc( - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression COUNT; typedef u8; typedef __u8; @@ ( kmalloc( - sizeof(u8) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(__u8) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(char) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(unsigned char) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(u8) * COUNT + COUNT , ...) | kmalloc( - sizeof(__u8) * COUNT + COUNT , ...) | kmalloc( - sizeof(char) * COUNT + COUNT , ...) | kmalloc( - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - kmalloc + kmalloc_array ( - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ identifier SIZE, COUNT; @@ - kmalloc + kmalloc_array ( - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( kmalloc( - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( kmalloc( - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kmalloc( - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kmalloc( - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ identifier STRIDE, SIZE, COUNT; @@ ( kmalloc( - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression E1, E2, E3; constant C1, C2, C3; @@ ( kmalloc(C1 * C2 * C3, ...) | kmalloc( - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | kmalloc( - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | kmalloc( - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | kmalloc( - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( kmalloc(sizeof(THING) * C2, ...) | kmalloc(sizeof(TYPE) * C2, ...) | kmalloc(C1 * C2 * C3, ...) | kmalloc(C1 * C2, ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - (E1) * E2 + E1, E2 , ...) | - kmalloc + kmalloc_array ( - (E1) * (E2) + E1, E2 , ...) | - kmalloc + kmalloc_array ( - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook <keescook@chromium.org>
2017-12-19staging: rtl8192u: ieee80211: ieee80211_rx.c fix checkpatch space prohibited ↵Abdul Rauf1-6/+6
before that '++' Fix the following errors: space prohibited before that '++' (ctx:WxO) Signed-off-by: Abdul Rauf <abdulraufmujahid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: rtl8192u: reduce stack frame size in ieee80211_rx_mgt_rslArnd Bergmann1-36/+42
I ran into a stack frame size warning in code that hasn't changed much recently, no idea why I didn't spot this earlier despite build many thousand randconfigs. drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function 'ieee80211_rx_mgt_rsl': drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:2563:1: error: the frame size of 1676 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] We have a couple of other copies of the same function in the kernel, and they simply don't put a gigantic structure on the stack, so I'm changing this copy to do the same as the others, replacing the stack variable with a GFP_ATOMIC allocation. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20net: manual clean code which call skb_put_[data:zero]yuan linyu1-3/+1
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16networking: introduce and use skb_put_data()Johannes Berg1-5/+4
A common pattern with skb_put() is to just want to memcpy() some data into the new space, introduce skb_put_data() for this. An spatch similar to the one for skb_put_zero() converts many of the places using it: @@ identifier p, p2; expression len, skb, data; type t, t2; @@ ( -p = skb_put(skb, len); +p = skb_put_data(skb, data, len); | -p = (t)skb_put(skb, len); +p = skb_put_data(skb, data, len); ) ( p2 = (t2)p; -memcpy(p2, data, len); | -memcpy(p, data, len); ) @@ type t, t2; identifier p, p2; expression skb, data; @@ t *p; ... ( -p = skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); | -p = (t *)skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); ) ( p2 = (t2)p; -memcpy(p2, data, sizeof(*p)); | -memcpy(p, data, sizeof(*p)); ) @@ expression skb, len, data; @@ -memcpy(skb_put(skb, len), data, len); +skb_put_data(skb, data, len); (again, manually post-processed to retain some comments) Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-04-28staging: rtl8192u: fix incorrect assignmentsJakub Jedelsky1-4/+6
Fixing warnings found by sparse on rtl8192u/ieee80211. drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1318:45: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1318:45: expected unsigned short [unsigned] [usertype] len drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1318:45: got restricted __be16 [usertype] <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1481:40: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1481:40: expected restricted __le16 <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1481:40: got int drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1483:40: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1483:40: expected restricted __le16 <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1483:40: got int drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1487:45: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1487:45: expected restricted __le16 <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1487:45: gotunsigned short [unsigned] [usertype] <noident> Signed-off-by: Jakub Jedelsky <jakub.jedelsky@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09staging: rtl8192e: Indent the codeGeorgiana Rodica Chelu1-1/+1
Indent the code in order to follow the rules and to increase the readability of the code. Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07staging: rtl8192u: Replace "the the " with "the"simran singhal1-1/+1
This patch replace "the the " with "the". The replacement couldn't be automated because sometimes the first "the" was meant to be another word. Signed-off-by: simran singhal <singhalsimran0@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: rtl8192u: Fix endianness warnings in ieee80211_rx.cSebastian Haas1-26/+26
Fixes the endianness warning "restricted __le16 degrades to integer" by converting __le16 to short before using it in bitmasks or in the macro WLAN_FC_GET_STYPE. Signed-off-by: Sebastian Haas <sehaas@deebas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: rtl8192u: Fix warnings about endiannessmaomao xu1-3/+1
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: expected unsigned short [unsigned] [usertype] len drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: got restricted __be16 [usertype] <noident> Signed-off-by: maomao xu <albert008.xu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>