summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8712
AgeCommit message (Collapse)AuthorFilesLines
2024-09-13staging: rtl8712: remove unused drvinfo_sz from update_recvframe_attribPing-Ke Shih1-4/+0
The drvinfo_sz is a size of hardware generated data putting in front of real RX data. The functions r8712_rxcmd_event_hdl() and recvbuf2recvframe() have its own parsing code to get drvinfo_sz to access real RX data, so removing this unused drvinfo_sz is safe. Otherwise, clang report: rtl8712_recv.c:139:6: warning: variable 'drvinfo_sz' set but not used [-Wunused-but-set-variable] 139 | u16 drvinfo_sz; | ^ Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240913002815.5149-2-pkshih@realtek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-29staging: rtl8712: Calculate size from pointerManisha Singh1-1/+1
Calculate the size from the pointer instead of struct to adhere to kernel coding style. Signed-off-by: Manisha Singh <masingh.linux@gmail.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240828222153.68062-4-masingh.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-29staging: rtl8712: Fix style issues in rtl871x_io.cManisha Singh1-2/+2
Refactor the _init_intf_hdl() function to avoid multiple assignments in a single statement. This change improves code readability and adheres to kernel coding style guidelines. Signed-off-by: Manisha Singh <masingh.linux@gmail.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240828222153.68062-2-masingh.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-29staging: rtl8712: Align parenthesis in usb_ops_linux.cDorine Tipo1-1/+1
Fix the parenthesis alignment in r8712_read_port() function to match the opening parenthesis. This improves code readability and adheres to the kernel coding style. Signed-off-by: Dorine Tipo <dorine.a.tipo@gmail.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240828082935.GA3815@ubuntu-focal Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-30staging: rtl8712: remove trailing whitespaceFelix Yan1-1/+1
Fix the following checkpatch.pl error: ERROR: trailing whitespace Signed-off-by: Felix Yan <felixonmars@archlinux.org> Link: https://lore.kernel.org/r/20240730063746.176245-1-felixonmars@archlinux.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-29staging: rtl8712: style fix multiple line dereferenceMoon Yeounsu1-2/+3
It fix the following checkpatch.pl warning: Avoid multiple line dereference - prefer %s Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Moon Yeounsu <yyyynoom@gmail.com> Link: https://lore.kernel.org/r/20240721040504.1483-1-yyyynoom@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04staging: r8712u: remove unused struct 'zero_bulkout_context'Dr. David Alan Gilbert1-7/+0
Remove struct zero_bulkout_context as it is unused. Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> AW-NU120 Link: https://lore.kernel.org/r/20240601131611.52441-1-linux@treblig.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04staging: rtl8712: Fix spelling mistake in rtl871x_io.hRoshan Khatri1-1/+1
This patch corrects misspelled word to increase code readability and searching. Signed-off-by: Roshan Khatri <topofeverest8848@gmail.com> Reviewed-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240525160230.66365-1-topofeverest8848@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04staging: rtl8712: remove unnecessary alignment of pxmitpriv->pxmitbufNam Cao2-9/+5
This driver wants pxmitpriv->pxmitbuf to be 4-byte aligned. This is ensured by allocating 4 more bytes than required with kmalloc(), then do the p = p + 4 - (p & 3) trick to make sure the pointer is 4-byte aligned. This is unnecessary. Pointers from kmalloc() are already at least 8-byte-aligned. Remove this alignment trick to simplify the code, and also to stop wasting 4 extra bytes of dynamic memory allocator. This also gets rid of a (false) warning from kmemleak. This 4-byte-aligned buffer is used to store pointers from kmalloc(). For 64-bit platforms, pointer size is 8 bytes and kmemleak only scans for pointers in 8-byte blocks, thus it misses the pointers stored in this 4-byte-aligned buffer and thinks that these pointers have been leaked. This is just a false warning, not a real problem. But still, it would be nice to get rid of these warnings. Reported-and-tested-by: syzbot+83763e624cfec6b462cb@syzkaller.appspotmail.com Closes: https://lore.kernel.org/linux-staging/000000000000809328060a8a4c1c@google.com Signed-off-by: Nam Cao <namcao@linutronix.de> Link: https://lore.kernel.org/r/20240525073229.4144612-1-namcao@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04staging: rtl8712: Fix spelling mistake in rtl871x_mlme.cRoshan Khatri1-1/+1
This patch corrects misspelled word to increase code readability and searching. Signed-off-by: Roshan Khatri <topofeverest8848@gmail.com> Reviewed-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240524154001.63946-1-topofeverest8848@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04staging: rtl8712: Fix spelling mistake in rtl8712_xmit.cRoshan Khatri1-1/+1
codespell reported misspelled aggregation in rtl8712_xmit.c. This patch corrects the spelling to increase code readability and searching. Signed-off-by: Roshan Khatri <topofeverest8848@gmail.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240521143617.53139-1-topofeverest8848@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04staging: rtl8712: Fix spelling mistake in rtl871x_event.hRoshan Khatri1-1/+1
codespell reported misspelled joining in rtl871x_event.h. Correcting the misspelled word improves readability and helps in searching. Signed-off-by: Roshan Khatri <topofeverest8848@gmail.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/20240521095633.50753-1-topofeverest8848@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-26staging: rtl8712: rename backupTKIPCountermeasure to backup_TKIP_countermeasureAyush Tiwari1-3/+3
Rename variable backupTKIPCountermeasure to backup_TKIP_countermeasure to address checkpatch warning 'Avoid Camelcase' and to ensure adherence to coding style guidelines. Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Link: https://lore.kernel.org/r/3fd64e6671d3f86c49fd8c6ba9ef64c4f0e0b75e.1711388443.git.ayushtiw0110@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-26staging: rtl8712: rename backupPMKIDIndex to backup_PMKID_indexAyush Tiwari1-3/+3
Rename variable backupPMKIDIndex to backup_PMKID_index to address checkpatch warning 'Avoid Camelcase' and to ensure adherence to coding style guidelines. Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Link: https://lore.kernel.org/r/2902ed6252d6773fecd32254383eefe8b0c465aa.1711388443.git.ayushtiw0110@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-26staging: rtl8712: rename backupPMKIDList to backup_PMKID_listAyush Tiwari1-3/+3
Rename backupPMKIDList to backup_PMKID_list and remove extra spaces between RT_PMKID_LIST and backupPMKIDList to address checkpatch warnings and match the common kernel coding style. Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Link: https://lore.kernel.org/r/5d3930cb847fd311afdd16c8fb947133ec49b55e.1711388443.git.ayushtiw0110@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: rtl8712: Add space between operands and operatorAyush Tiwari1-1/+1
Add whitespace in union recvstat between operator '>>' and operands 'RXDESC_SIZE' and '2' to conform to common kernel coding style. Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Link: https://lore.kernel.org/r/ZgCYHwYOmqfwMeU0@ayush-HP-Pavilion-Gaming-Laptop-15-ec0xxx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: rtl8712: Remove additional spaceAyush Tiwari1-1/+1
Remove additional whitespaces in SwLedOn() between u8 and LedCfg to conform to common kernel coding style. Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Link: https://lore.kernel.org/r/ZgCWdfJit4Ly14NB@ayush-HP-Pavilion-Gaming-Laptop-15-ec0xxx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: rtl8712: Fix line length exceeding 100 columnsAyush Tiwari1-1/+2
Split the argument list of the kthread_run function call across two lines to address the checkpatch warning "line length exceeds 100 columns". Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/ZfvaZd92bnoZ9M1m@ayush-HP-Pavilion-Gaming-Laptop-15-ec0xxx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: rtl8712: rename tmpVal to avg_valAyush Tiwari1-3/+3
Rename tmpVal to avg_val in process_link_qual() to reflect the intended use of the variable and conform to the kernel coding style. Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Fabio M. De Francesco <fabio.maria.de.francesco@linux.intel.com> Link: https://lore.kernel.org/r/ZfF+qu+CGHlpHrtY@ayush-HP-Pavilion-Gaming-Laptop-15-ec0xxx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-23staging: rtl8712: fix open parentheses alignmentRyan England7-301/+173
Adhere to Linux kernel coding style. Reported by checkpatch: CHECK: Alignment should match open parenthesis Signed-off-by: Ryan England <rcengland@gmail.com> Link: https://lore.kernel.org/r/ZYSemFbzTlgLROMc@kernel.ryanengland.xyz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-18drivers: staging: rtl8712: Fixes spelling mistake in rtl871x_mp_phy_regdef.hDipendra Khadka1-1/+1
The script checkpatch.pl reported spelling error in rtl871x_mp_phy_regdef.h as below: ''' WARNING: 'Tranceiver' may be misspelled - perhaps 'Transceiver'? #129: #define rFPGA0_XA_LSSIReadBack 0x8a0 /* Tranceiver LSSI Readback */ ^^^^^^^^^^ ''' This patch corrects a spelling error, changing "Tranceiver" to "Transceiver." Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com> Link: https://lore.kernel.org/r/20231217165444.448133-1-kdipendra88@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-04staging: rtl8712: fix race conditionNam Cao2-1/+1
In probe function, request_firmware_nowait() is called to load firmware asynchronously. At completion of firmware loading, register_netdev() is called. However, a mutex needed by netdev is initialized after the call to request_firmware_nowait(). Consequently, it can happen that register_netdev() is called before the driver is ready. Move the mutex initialization into r8712_init_drv_sw(), which is called before request_firmware_nowait(). Reported-by: syzbot+b08315e8cf5a78eed03c@syzkaller.appspotmail.com Closes: https://lore.kernel.org/linux-staging/000000000000d9d4560601b8e0d7@google.com/T/#u Fixes: 8c213fa59199 ("staging: r8712u: Use asynchronous firmware loading") Cc: stable <stable@kernel.org> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/20230731110620.116562-1-namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-07-27staging: r8712: Fix memory leak in _r8712_init_xmit_priv()Larry Finger2-9/+40
In the above mentioned routine, memory is allocated in several places. If the first succeeds and a later one fails, the routine will leak memory. This patch fixes commit 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel"). A potential memory leak in r8712_xmit_resource_alloc() is also addressed. Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel") Reported-by: syzbot+cf71097ffb6755df8251@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/x/log.txt?x=11ac3fa0a80000 Cc: stable@vger.kernel.org Cc: Nam Cao <namcaov@gmail.com> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Reviewed-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/20230714175417.18578-1-Larry.Finger@lwfinger.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-15staging: rtl8172: Add blank lines after declarationsSrihari S1-0/+1
Add blank lines as reported by checkpatch.pl as below CHECK: Please use a blank line after function/struct/union/enum declarations Signed-off-by: Srihari S <sriharisat@gmail.com> Link: https://lore.kernel.org/r/1680966983-11609-1-git-send-email-sriharisat@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-08staging: rtl8712: Fix multiple line dereferenceShibo Li1-2/+2
This patch fixes the following warning in rtl871x_mlme.c WARNING: Avoid multiple line dereference - prefer 'adapter->securitypriv.PrivacyAlgrthm' Signed-off-by: Shibo Li <zzutcyha@163.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> AW-NU120 Reviewed-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/20230220084050.18459-1-zzutcyha@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-08staging: rtl8712: Remove extra spacesShibo Li1-46/+47
This patch fixes the problem of irregular indentation Signed-off-by: Shibo Li <zzutcyha@163.com> Link: https://lore.kernel.org/r/20230220090430.19589-1-zzutcyha@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-31staging: rtl8712: fix potential memory leakNam Cao1-5/+18
In r8712_init_drv_sw(), whenever any function call returns error, it is returned immediately without properly cleaning up the other successfully executed functions. This can cause memory leak. Instead of return immediately, free all the allocated buffers first. Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/0a3414b12031f6cdcba81a8725e91eb9567ff34f.1666688642.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-31staging: rtl8712: check for return value of _r8712_init_xmit_priv()Nam Cao1-1/+3
The return value of _r8712_init_xmit_priv() is never checked and the driver always continue execution as if all is well. This will cause problems if, for example, buffers cannot be allocated and the driver continue and use those buffers. Check for return value of _r8712_init_xmit_priv() and return error (if any) during probing. Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/b550803561acf26af71f2377215c28b94435a644.1666688642.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-31staging: rtl8712: check for alloc fail in _r8712_init_recv_priv()Nam Cao4-12/+20
The function _r8712_init_recv_priv() and also r8712_init_recv_priv() just returns silently if they fail to allocate memory. Change their return type to int and add necessary checks and handling if they return -ENOMEM Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/506ac35a667e511db568b06b86834fd0ceeba453.1666688642.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-31Revert "staging: r8712u: Tracking kmemleak false positives."Nam Cao1-3/+0
This reverts commit 5d3da4a20a271e3cf5496a50cbb8118aa019374f. This commit annotated false positive for kmemleak. The reasoning is that the buffers are freed when the driver is unloaded. However, there is actually potential memory leak when probe fails. Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/26ce206b2c40c7db48c146aa6105789db9dfcc1a.1666688642.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-22staging: rtl8712: Remove variable xcntColin Ian King1-2/+1
The variable xcnt being incremented but it is never referenced, it is redundant and can be removed. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20221021180950.29139-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-09staging: rtl8712: Fix return type for implementation of ndo_start_xmitGUO Zihua2-4/+4
CFI (Control Flow Integrity) is a safety feature allowing the system to detect and react should a potential control flow hijacking occurs. In particular, the Forward-Edge CFI protects indirect function calls by ensuring the prototype of function that is actually called matches the definition of the function hook. Since Linux now supports CFI, it will be a good idea to fix mismatched return type for implementation of hooks. Otherwise this would get cought out by CFI and cause a panic. Use enums from netdev_tx_t as return value instead, then change return type to netdev_tx_t. Signed-off-by: GUO Zihua <guozihua@huawei.com> Link: https://lore.kernel.org/r/20220905130230.11230-1-guozihua@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-09staging: rtl8712: fix camelcase in UserPriorityAsif Khan1-6/+6
Replace camelcase variable UserPriority with snake case variable user_priority. Signed-off-by: Asif Khan <asif.kgauri@gmail.com> Link: https://lore.kernel.org/r/20220904192400.8309-1-asif.kgauri@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-30staging: rtl8712: fix use after free bugsDan Carpenter1-36/+0
_Read/Write_MACREG callbacks are NULL so the read/write_macreg_hdl() functions don't do anything except free the "pcmd" pointer. It results in a use after free. Delete them. Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel") Cc: stable <stable@kernel.org> Reported-by: Zheng Wang <hackerzheng666@gmail.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/Yw4ASqkYcUhUfoY2@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19staging: rtl8712: fix uninit-value in r871xu_drv_init()Wang Cheng1-3/+3
When 'tmpU1b' returns from r8712_read8(padapter, EE_9346CR) is 0, 'mac[6]' will not be initialized. BUG: KMSAN: uninit-value in r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541 r871xu_drv_init+0x2d54/0x3070 drivers/staging/rtl8712/usb_intf.c:541 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396 really_probe+0x653/0x14b0 drivers/base/dd.c:596 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752 driver_probe_device drivers/base/dd.c:782 [inline] __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427 __device_attach+0x593/0x8e0 drivers/base/dd.c:970 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487 device_add+0x1fff/0x26e0 drivers/base/core.c:3405 usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238 usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293 really_probe+0x653/0x14b0 drivers/base/dd.c:596 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752 driver_probe_device drivers/base/dd.c:782 [inline] __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427 __device_attach+0x593/0x8e0 drivers/base/dd.c:970 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487 device_add+0x1fff/0x26e0 drivers/base/core.c:3405 usb_new_device+0x1b8e/0x2950 drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5358 [inline] hub_port_connect_change drivers/usb/core/hub.c:5502 [inline] port_event drivers/usb/core/hub.c:5660 [inline] hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5742 process_one_work+0xdb6/0x1820 kernel/workqueue.c:2307 worker_thread+0x10b3/0x21e0 kernel/workqueue.c:2454 kthread+0x3c7/0x500 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 Local variable mac created at: r871xu_drv_init+0x1771/0x3070 drivers/staging/rtl8712/usb_intf.c:394 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396 KMSAN: uninit-value in r871xu_drv_init https://syzkaller.appspot.com/bug?id=3cd92b1d85428b128503bfa7a250294c9ae00bd8 Reported-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com> Tested-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Wang Cheng <wanngchenng@gmail.com> Link: https://lore.kernel.org/r/14c3886173dfa4597f0704547c414cfdbcd11d16.1652618244.git.wanngchenng@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19staging: rtl8712: fix uninit-value in usb_read8() and friendsWang Cheng1-9/+18
When r8712_usbctrl_vendorreq() returns negative, 'data' in usb_read{8,16,32} will not be initialized. BUG: KMSAN: uninit-value in string_nocheck lib/vsprintf.c:643 [inline] BUG: KMSAN: uninit-value in string+0x4ec/0x6f0 lib/vsprintf.c:725 string_nocheck lib/vsprintf.c:643 [inline] string+0x4ec/0x6f0 lib/vsprintf.c:725 vsnprintf+0x2222/0x3650 lib/vsprintf.c:2806 va_format lib/vsprintf.c:1704 [inline] pointer+0x18e6/0x1f70 lib/vsprintf.c:2443 vsnprintf+0x1a9b/0x3650 lib/vsprintf.c:2810 vprintk_store+0x537/0x2150 kernel/printk/printk.c:2158 vprintk_emit+0x28b/0xab0 kernel/printk/printk.c:2256 dev_vprintk_emit+0x5ef/0x6d0 drivers/base/core.c:4604 dev_printk_emit+0x1dd/0x21f drivers/base/core.c:4615 __dev_printk+0x3be/0x440 drivers/base/core.c:4627 _dev_info+0x1ea/0x22f drivers/base/core.c:4673 r871xu_drv_init+0x1929/0x3070 drivers/staging/rtl8712/usb_intf.c:401 usb_probe_interface+0xf19/0x1600 drivers/usb/core/driver.c:396 really_probe+0x6c7/0x1350 drivers/base/dd.c:621 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752 driver_probe_device drivers/base/dd.c:782 [inline] __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427 __device_attach+0x593/0x8e0 drivers/base/dd.c:970 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487 device_add+0x1fff/0x26e0 drivers/base/core.c:3405 usb_set_configuration+0x37e9/0x3ed0 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0x13c/0x300 drivers/usb/core/generic.c:238 usb_probe_device+0x309/0x570 drivers/usb/core/driver.c:293 really_probe+0x6c7/0x1350 drivers/base/dd.c:621 __driver_probe_device+0x3e9/0x530 drivers/base/dd.c:752 driver_probe_device drivers/base/dd.c:782 [inline] __device_attach_driver+0x79f/0x1120 drivers/base/dd.c:899 bus_for_each_drv+0x2d6/0x3f0 drivers/base/bus.c:427 __device_attach+0x593/0x8e0 drivers/base/dd.c:970 device_initial_probe+0x4a/0x60 drivers/base/dd.c:1017 bus_probe_device+0x17b/0x3e0 drivers/base/bus.c:487 device_add+0x1fff/0x26e0 drivers/base/core.c:3405 usb_new_device+0x1b91/0x2950 drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5363 [inline] hub_port_connect_change drivers/usb/core/hub.c:5507 [inline] port_event drivers/usb/core/hub.c:5665 [inline] hub_event+0x58e3/0x89e0 drivers/usb/core/hub.c:5747 process_one_work+0xdb6/0x1820 kernel/workqueue.c:2289 worker_thread+0x10d0/0x2240 kernel/workqueue.c:2436 kthread+0x3c7/0x500 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 Local variable data created at: usb_read8+0x5d/0x130 drivers/staging/rtl8712/usb_ops.c:33 r8712_read8+0xa5/0xd0 drivers/staging/rtl8712/rtl8712_io.c:29 KMSAN: uninit-value in r871xu_drv_init https://syzkaller.appspot.com/bug?id=3cd92b1d85428b128503bfa7a250294c9ae00bd8 Reported-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com> Tested-by: <syzbot+6f5ecd144854c0d8580b@syzkaller.appspotmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Wang Cheng <wanngchenng@gmail.com> Link: https://lore.kernel.org/r/b9b7a6ee02c02aa28054f5cf16129977775f3cd9.1652618244.git.wanngchenng@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19staging: rtl8712: add error handler in r8712_usbctrl_vendorreq()Wang Cheng1-7/+14
When 'status' returned from usb_control_msg() is not equal to 'len', that usb_control_msg() is on partial failure, r8712_usbctrl_vendorreq() will treat partial reads as success. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Wang Cheng <wanngchenng@gmail.com> Link: https://lore.kernel.org/r/e33ea53d36c422fbe7eabec5bd9eecb0ebce1bc5.1652618244.git.wanngchenng@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-20staging: rtl8712: Remove unnecessary int typecastSolomon Tan1-2/+2
This patch gets rid of the following error from checkpatch.pl: WARNING: Unnecessary typecast of c90 int constant. Signed-off-by: Solomon Tan <solomonbstoner@protonmail.ch> Link: https://lore.kernel.org/r/YlxGTMBsLqdOIrpC@ArchDesktop Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-14staging: rtl8712: Remove unnecessary parenthesesAliya Rahmani1-1/+1
Remove redundant parentheses reported by checkpatch. Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com> Link: https://lore.kernel.org/r/20220413182303.34807-1-aliyarahmani786@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-14staging: rtl8712: cmd: remove redundant space after castAliya Rahmani1-1/+1
Remove the unnecessary space immediately after a cast. Identified by checkpatch: CHECK: No space is necessary after a cast. Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com> Link: https://lore.kernel.org/r/20220413113531.31224-1-aliyarahmani786@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-12staging/rtl8712: remove event_taskletDavidlohr Bueso1-1/+0
This is unused. Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Link: https://lore.kernel.org/r/20220411151620.129178-6-dave@stgolabs.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-12staging: rtl8712: efuse: code style - avoid macro argument precedence issuesAliya Rahmani1-2/+2
This patch fixes checkpatch warnings of precedence issues. Added parentheses around macro arguments 'offset' and 'word_en'. Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com> Link: https://lore.kernel.org/r/20220412071456.40980-1-aliyarahmani786@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-07staging: rtl8712: fix camel case in function r8712_generate_ieMahak Gupta1-2/+2
Adhere to linux kernel coding style. Reported by checkpatch: CHECK: Avoid CamelCase: <beaconPeriod> Signed-off-by: Mahak Gupta <mahak_g@cs.iitr.ac.in> Link: https://lore.kernel.org/r/20220407120945.31030-1-mahak_g@cs.iitr.ac.in Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-07staging: rtl8712: remove unnecessary parenthesesAlaa Mohamed1-10/+10
Reported by checkpatch: Remove unnecessary parentheses around structure field references Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com> Link: https://lore.kernel.org/r/20220407125947.8525-1-eng.alaamohamedsoliman.am@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8712: fix a potential memory leak in r871xu_drv_init()Xiaoke Wang2-4/+3
In r871xu_drv_init(), if r8712_init_drv_sw() fails, then the memory allocated by r8712_alloc_io_queue() in r8712_usb_dvobj_init() is not properly released as there is no action will be performed by r8712_usb_dvobj_deinit(). To properly release it, we should call r8712_free_io_queue() in r8712_usb_dvobj_deinit(). Besides, in r871xu_dev_remove(), r8712_usb_dvobj_deinit() will be called by r871x_dev_unload() under condition `padapter->bup` and r8712_free_io_queue() is called by r8712_free_drv_sw(). However, r8712_usb_dvobj_deinit() does not rely on `padapter->bup` and calling r8712_free_io_queue() in r8712_free_drv_sw() is negative for better understading the code. So I move r8712_usb_dvobj_deinit() into r871xu_dev_remove(), and remove r8712_free_io_queue() from r8712_free_drv_sw(). Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_B8048C592777830380A23A7C4409F9DF1305@qq.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8712: simplify control flowSevinj Aghayeva1-19/+6
The function iterates an index from 0 to NUM_PMKID_CACHE and returns the first index for which the condition is true. If no such index is found, the function returns -1. Current code has a complex control flow that obfuscates this simple task. Replace it with a loop. Also, given the shortened function body, replace the long variable name psecuritypriv with a short variable name p. Reported by checkpatch: WARNING: else is not generally useful after a break or return Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/20220403165325.GA374638@euclid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8712: remove Unnecessary parenthesesAlaa Mohamed1-8/+8
Reported by checkpatch: CHECK: Unnecessary parentheses Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com> Link: https://lore.kernel.org/r/20220404211942.11446-1-eng.alaamohamedsoliman.am@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8712: Fix multiple line dereferenceAlaa Mohamed1-52/+25
Reported by checkpatch: WARNING: Avoid multiple line dereference Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com> Link: https://lore.kernel.org/r/20220404210010.9795-1-eng.alaamohamedsoliman.am@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-04staging: rtl8712: Fix multiple blank lines warning from .c filesSathish Kumar4-4/+0
This patch fixes the checkpatch.pl warnings like: CHECK: Please don't use multiple blank lines + + from rtl871x_ioctl_rtl.c, rtl871x_ioctl_set.c, rtl871x_recv.c, and rtl871x_security.c Signed-off-by: Sathish Kumar <skumark1902@gmail.com> Link: https://lore.kernel.org/r/20220404035213.2609-1-skumark1902@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-04staging: rtl8712: Fix multiple blank lines warning from .h filesSathish Kumar16-28/+0
This patch fixes the checkpatch.pl warnings like: CHECK: Please don't use multiple blank lines + + from rtl8712_*.h, rtl871x_*.h, sta_info.h, and wifi.h Signed-off-by: Sathish Kumar <skumark1902@gmail.com> Link: https://lore.kernel.org/r/20220404034706.2384-1-skumark1902@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>