summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8712
AgeCommit message (Collapse)AuthorFilesLines
2021-03-20staging: rtl8712: Fix a possible NULL pointer dereference in function ↵Lee Gibson1-1/+2
r8712_joinbss_event_callback GCC 10 analyzer reports a warning: dereference of NULL The function r8712_find_network can return NULL and is usually checked but no check is present is this case. Fix by adding the check. Signed-off-by: Lee Gibson <leegib@gmail.com> Link: https://lore.kernel.org/r/20210319085836.8259-1-leegib@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-15Merge 5.12-rc3 into staging-nextGreg Kroah-Hartman2-3/+5
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-12staging: rtl8712: fixed whitespace coding style issueSelvakumar Elangovan1-3/+0
Removed additional whitespaces in the rtl8712_xmit.h file. Signed-off-by: Selvakumar Elangovan <selvakumar16197@gmail.com> Link: https://lore.kernel.org/r/20210309150037.17883-1-selvakumar16197@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-12staging: rtl8712: fixed no space coding style issueSelvakumar Elangovan1-1/+1
Added space around the binary operator for readability in rtl8712_xmit.h file Signed-off-by: Selvakumar Elangovan <selvakumar16197@gmail.com> Link: https://lore.kernel.org/r/20210309142547.16974-1-selvakumar16197@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: replace cap_* definitions with native kernel WLAN_CAPABILITY_*Ivan Safonov2-10/+3
cap_* definitions duplicate WLAN_CAPABILITY_*. Remove cap_* definitions, improve code consistency. Reviewed-by: Mike Ximing Chen <mike.ximing.chen@intel.com> Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-5-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: use IEEE80211_FCTL_* kernel definitionsIvan Safonov1-30/+22
_TO_DS_, _FROM_DS_, _MORE_FRAG_, _RETRY_, _PWRMGT_, _MORE_DATA_, _PRIVACY_, _ORDER_ definitions are duplicate IEEE80211_FCTL_* kernel definitions. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-4-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: remove unused definitions from wifi.hIvan Safonov1-74/+0
These definitions are not used and will not be useful in the future. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-3-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: replace get_(d|s)a with ieee80211_get_(D|S)AIvan Safonov2-47/+2
get_da()/get_sa() duplicate native ieee80211_get_(D|S)A functions. Remove get_(d|s)a, use ieee80211_get_(D|S)A instead. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-2-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmdLee Gibson1-2/+4
Function r8712_sitesurvey_cmd calls memcpy without checking the length. A user could control that length and trigger a buffer overflow. Fix by checking the length is within the maximum allowed size. Signed-off-by: Lee Gibson <leegib@gmail.com> Link: https://lore.kernel.org/r/20210301132648.420296-1-leegib@gmail.com Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8712: unterminated string leads to read overflowDan Carpenter1-1/+1
The memdup_user() function does not necessarily return a NUL terminated string so this can lead to a read overflow. Switch from memdup_user() to strndup_user() to fix this bug. Fixes: c6dc001f2add ("staging: r8712u: Merging Realtek's latest (v2.6.6). Various fixes.") Cc: stable <stable@vger.kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YDYSR+1rj26NRhvb@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-09staging: rtl8712: Remove multiple blank linesAakash Hemadri1-2/+0
Fix checkpatch.pl CHECK: CHECK: Please don't use multiple blank lines Signed-off-by: Aakash Hemadri <aakashhemadri123@gmail.com> Link: https://lore.kernel.org/r/20210209153709.128676-1-aakashhemadri123@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-04staging: rtl8712: Switch from strlcpy to strscpyKumar Kartikeya Dwivedi1-1/+1
strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20210131172838.146706-12-memxor@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-31staging:rtl8712: remove unused enum WIFI_STATUS_CODEIvan Safonov1-14/+0
Improve readability. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210131080912.25264-1-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-01staging: rtl8712: Fix enqueue_reorder_recvframe()Dan Carpenter1-3/+6
The logic of this function was accidentally broken by a checkpatch inspired cleanup. I've modified the code to restore the original behavior and also make checkpatch happy. Fixes: 98fe05e21a6e ("staging: rtl8712: Remove unnecesary else after return statement.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20200929103548.GA493135@mwanda Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-22staging: rtl8712: use shorter array initializationsMichael Straube1-4/+3
Use empty brace syntax to initialize zero valued arrays. Simplifies and shortens the code a little bit. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200919085032.32453-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-22staging: rtl8712: clean up comparsions to NULLMichael Straube10-47/+46
Clean up comparsions to NULL Reported by checkpatch. if (x == NULL) -> if (!x) if (x != NULL) -> if (x) Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200919085032.32453-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-16staging: rtl8712: convert tasklets to use new tasklet_setup() APIAllen Pais4-10/+10
In preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly. Signed-off-by: Romain Perier <romain.perier@gmail.com> Signed-off-by: Allen Pais <apais@linux.microsoft.com> Link: https://lore.kernel.org/r/20200916061831.57848-1-allen.lkml@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-29Staging: rtl8712: Fixed a coding sytle issueAnkit Baluni1-2/+1
Removed braces for a 'if' condition as it contain only single line & there is no need for braces for such case according to coding style rules. Signed-off-by: Ankit Baluni <b18007@students.iitmandi.ac.in> Link: https://lore.kernel.org/r/20200729074541.1972-1-b18007@students.iitmandi.ac.in Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-28staging: rtl8712: Use fallthrough pseudo-keywordGustavo A. R. Silva1-1/+1
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200727185838.GA29595@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-17staging: rtl*/security: Use static const in array declarationsJoe Perches1-1/+1
Use static const in declarations where appropriate. Signed-off-by: Joe Perches <joe@perches.com> Link: https://lore.kernel.org/r/818bbd25924f0c733a4a39d426fd30392d4eae80.camel@perches.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-17staging: rtl8712: handle firmware load failureRustam Kovhaev2-4/+10
when firmware fails to load we should not call unregister_netdev() this patch fixes a race condition between rtl871x_load_fw_cb() and r871xu_dev_remove() and fixes the bug reported by syzbot Reported-by: syzbot+80899a8a8efe8968cde7@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=80899a8a8efe8968cde7 Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200716151324.1036204-1-rkovhaev@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712/: Using comparison to true is error proneJohn Oldman1-4/+4
clear below issues reported by checkpatch.pl: CHECK: Using comparison to true is error prone CHECK: Comparison to NULL should be written "!oldest" Signed-off-by: John Oldman <john.oldman@polehill.co.uk> Link: https://lore.kernel.org/r/20200710113113.1648-1-john.oldman@polehill.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712: Use proper format in call to dev_err()Mauro Dreissig1-2/+2
In the call to dev_err(), remove the cast of size_t to int and change the format string accordingly. As reported by the kernel test robot, the correct format string for a size_t argument should be %zu. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200705143552.9368-6-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712: Remove variable 'raw' from rtl871x_open_fw()Mauro Dreissig1-4/+2
Remove useless variable 'raw' from function rtl871x_open_fw() making the code a bit easier to understand. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200705143552.9368-5-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712: Use ETH_ALEN instead of hardcoded valueMauro Dreissig1-1/+1
Use macro ETH_ALEN which defines the number of octets in an ethernet address. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200705143552.9368-4-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712: Simplify expressions with boolean logicMauro Dreissig3-6/+5
Simplify some expressions by using boolean operations. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200705143552.9368-3-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712: Replace constant 49152 with expression 48 * 1024Mauro Dreissig1-1/+1
This way we don't need the comment stating that 49152 equals 48k. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200705143552.9368-2-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712: Annotate r8712_sitesurvey_cmd()Mauro Dreissig1-6/+1
Add __must_hold() sparse annotation to r8712_sitesurvey_cmd(), replacing the comments on top of the function. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200705180944.20958-1-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03staging: rtl8712: base_types: Remove unused macrosMauro Dreissig1-7/+0
Those #define's are not used anywhere, get rid of them. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200701214420.5566-3-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03staging: rtl8712: Replace FIELD_OFFSET() with offsetof()Mauro Dreissig3-5/+4
Use the existing offsetof() macro instead of duplicating code. Signed-off-by: Mauro Dreissig <mukadr@gmail.com> Link: https://lore.kernel.org/r/20200701214420.5566-2-mukadr@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03staging: rtl8712: use common ieee80211 constantsMichael Straube3-56/+5
Many defined constants in wifi.h are unused and/or available from <linux/ieee80211.h>, some with slightly different names. Use the common ones, rename where necessary and remove unused. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200701164213.4205-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-01staging: rtl8712: remove some ieee80211 constants from wifi.hMichael Straube1-4/+0
The constants IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL and IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA are not used in the driver code and, if ever needed, available from 'include/linux/ieee80211.h'. Remove them from wifi.h. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200629171405.7711-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-18staging:rtl8712: avoid skb_clone after skb allocation failIvan Safonov1-18/+11
The skb allocated when out of memory is likely to be discarded during subsequent processing. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20200531110548.9318-1-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-16staging: rtl8712: Remove unnecesary else after return statement.Sebastian Arriola1-2/+1
This patch fixes the checkpatch.pl warning: WARNING: else is not generally useful after a break or return 490: FILE: drivers/staging/rtl8712/rtl8712_recv.c:490: return false; else Signed-off-by: Sebastian Arriola <sebdeveloper6952@gmail.com> Link: https://lore.kernel.org/r/20200615155131.GA4563@sevic69 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-16staging: rtl8712: switch to common ieee80211 headersPascal Terjan10-633/+21
This patch switches to <linux/ieee80211.h> and <net/cfg80211.h> and deletes a lot of duplicate definitions plus many unused ones. Non obvious changes: - struct ieee80211_ht_cap is different enough that I preferred to keep (and rename) it for now. - mcs_rate in translate_scan was not read after being set, so I deleted that part rather than using the renamed struct - WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the corresponding one with same value Signed-off-by: Pascal Terjan <pterjan@google.com> Link: https://lore.kernel.org/r/20200609194848.166130-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASKPascal Terjan1-8/+1
The value in shared headers was fixed 9 years ago in commit 8d661f1e462d ("ieee80211: correct IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK macro") and while looking at using shared headers for other duplicated constants I noticed this driver uses the old value. The macros are also defined twice in this file so I am deleting the second definition. Signed-off-by: Pascal Terjan <pterjan@google.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200523211247.23262-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-16staging: rtl8712: correct spelling mistake in commentMichael Straube1-1/+1
Correct a spelling mistake discovered by checkpatch. attatch -> attach Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200413215109.15749-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: rtl8712: fix multiline derefernce warningsAiman Najjar1-7/+4
This patch fixes remaining checkpatch warnings in rtl871x_xmit.c: WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->PrivacyKeyIndex' 636: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:636: + (u8)psecuritypriv-> + PrivacyKeyIndex); WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid' 643: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:643: + (u8)psecuritypriv-> + XGrpKeyid); WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid' 652: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:652: + (u8)psecuritypriv-> + XGrpKeyid); Signed-off-by: Aiman Najjar <aiman.najjar@hurranet.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/98805a72b92e9bbf933e05b827d27944663b7bc1.1585508171.git.aiman.najjar@hurranet.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: rtl8712: code improvements to make_wlanhdrAiman Najjar2-64/+61
1. Refactor make_wlanhdr to improve code style. 2. Use ether_addr_copy instead of memcpy to copy addresses. Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: Aiman Najjar <aiman.najjar@hurranet.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/275773a0379e4a03839cd832d2ed952fd7bfee48.1585508171.git.aiman.najjar@hurranet.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: rtl8712: fix checkpatch warningsAiman Najjar1-8/+7
This patch fixes multiline dereference warnings in rtl871x_xmit.c: WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrptxmickey' 379: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:379: + psecuritypriv-> + XGrptxmickey[psecuritypriv-> WARNING: Avoid multiple line dereference - prefer 'psecuritypriv->XGrpKeyid' 380: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:380: + XGrptxmickey[psecuritypriv-> + XGrpKeyid].skey); Signed-off-by: Aiman Najjar <aiman.najjar@hurranet.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/ddd296c34c5b0206dfe5cf2e6cbe40e0a118c257.1585508171.git.aiman.najjar@hurranet.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: rtl8712: fix long-line checkpatch warningAiman Najjar1-2/+2
This patch fixes the following warning in rtl871x_xmit.c: WARNING: line over 80 characters 130: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:130: + pxmitbuf->pallocated_buf = kmalloc(MAX_XMITBUF_SZ + XMITBUF_ALIGN_SZ, Signed-off-by: Aiman Najjar <aiman.najjar@hurranet.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/de477e0d8f352c1d6cd75d64d84ac6f9017db254.1585508171.git.aiman.najjar@hurranet.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: rtl8712: fix checkpatch long-line warningAiman Najjar1-2/+3
This patch fixes these two long-line checkpatch warnings in rtl871x_xmit.c: WARNING: line over 80 characters \#74: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:74: + * Please allocate memory with the sz = (struct xmit_frame) * NR_XMITFRAME, WARNING: line over 80 characters \#79: FILE: drivers/staging//rtl8712/rtl871x_xmit.c:79: + kmalloc(NR_XMITFRAME * sizeof(struct xmit_frame) + 4, GFP_ATOMIC); Signed-off-by: Aiman Najjar <aiman.najjar@hurranet.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/acd523d0d24cc81fae9eb933a066d87815587cee.1585508171.git.aiman.najjar@hurranet.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20staging: rtl8712: Remove unnecessary bracesGokce Kuler1-2/+2
Remove unnecessary braces for single statement block Signed-off-by: Gokce Kuler <gokcekuler@gmail.com> Link: https://lore.kernel.org/r/20200320000326.GA9349@siyah2 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-19staging: rtl8712: Fix for long lines in Kconfig helpR Veera Kumar1-2/+5
Fixes two long line in Kconfig help. Found using checkpatch.pl Signed-off-by: R Veera Kumar <vkor@vkten.in> Link: https://lore.kernel.org/r/20200319095513.GA3078@tulip.local Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-19staging: rtl8712: Correct a typo in a commentR Veera Kumar1-1/+1
Correct a single typo in a comment. Misspelling found using checkpatch.pl. Signed-off-by: R Veera Kumar <vkor@vkten.in> Link: https://lore.kernel.org/r/20200319094358.GA2751@tulip.local Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-12staging: rtl8712: Fixes for simple typos in C commentsR Veera Kumar2-3/+3
Fixes for simple typos in C comments. Found using checkpatch.pl. Signed-off-by: R Veera Kumar <vkor@vkten.in> Link: https://lore.kernel.org/r/20200312091042.GA4246@tulip.local Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-23staging: Replace zero-length array with flexible-array memberGustavo A. R. Silva2-4/+4
The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200220132908.GA30501@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-22staging: rtl8712: simplify evm_db2percentage()Michael Straube1-8/+2
Use clamp() to simplify function evm_db2percentage() and reduce object file size. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200118195305.16685-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-10staging: rtl8712: fix interface sanity checkJohan Hovold1-1/+1
Make sure to use the current alternate setting when verifying the interface descriptors to avoid binding to an invalid interface. Failing to do so could cause the driver to misbehave or trigger a WARN() in usb_submit_urb() that kernels with panic_on_warn set would choke on. Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel") Cc: stable <stable@vger.kernel.org> # 2.6.37 Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20191210114751.5119-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-16staging: rtl*: Remove tasklet callback castsKees Cook4-11/+9
In order to make the entire kernel usable under Clang's Control Flow Integrity protections, function prototype casts need to be avoided because this will trip CFI checks at runtime (i.e. a mismatch between the caller's expected function prototype and the destination function's prototype). Many of these cases can be found with -Wcast-function-type, which found that the rtl wifi drivers had a bunch of needless function casts. Remove function casts for tasklet callbacks in the various drivers. Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/201911150926.2894A4F973@keescook Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>