* [PATCH] staging: rtl8192e: rtl_core: Fix possible null-pointer dereference in _rtl92e_pci_disconnect()
@ 2021-08-11 3:11 Tuo Li
2021-08-11 6:59 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Tuo Li @ 2021-08-11 3:11 UTC (permalink / raw)
To: gregkh, dan.carpenter, will+git, romain.perier, yashsri421, apais
Cc: linux-staging, linux-kernel, baijiaju1990, Tuo Li, TOTE Robot
The variable dev is checked in:
if (dev)
This indicates that it can be NULL. If so, a null-pointer dereference will
occur:
priv = rtllib_priv(dev);
However, the value of priv is not used in the remaining part of this
function. Thus the else-branch can be removed to fix this posible
null-pointer dereference.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index e85d9c2cdc96..0eb37a95b519 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2557,8 +2557,6 @@ static void _rtl92e_pci_disconnect(struct pci_dev *pdev)
release_mem_region(pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1));
}
- } else {
- priv = rtllib_priv(dev);
}
pci_disable_device(pdev);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: rtl8192e: rtl_core: Fix possible null-pointer dereference in _rtl92e_pci_disconnect()
2021-08-11 3:11 [PATCH] staging: rtl8192e: rtl_core: Fix possible null-pointer dereference in _rtl92e_pci_disconnect() Tuo Li
@ 2021-08-11 6:59 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-08-11 6:59 UTC (permalink / raw)
To: Tuo Li
Cc: gregkh, will+git, romain.perier, yashsri421, apais,
linux-staging, linux-kernel, baijiaju1990, TOTE Robot
On Tue, Aug 10, 2021 at 08:11:35PM -0700, Tuo Li wrote:
> The variable dev is checked in:
> if (dev)
>
> This indicates that it can be NULL. If so, a null-pointer dereference will
> occur:
> priv = rtllib_priv(dev);
>
> However, the value of priv is not used in the remaining part of this
> function. Thus the else-branch can be removed to fix this posible
> null-pointer dereference.
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Tuo Li <islituo@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Smatch was not smart enough to spot the dereference inside rtllib_priv().
Fortunately, the "dev" variable can't be NULL at this point.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-11 7:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 3:11 [PATCH] staging: rtl8192e: rtl_core: Fix possible null-pointer dereference in _rtl92e_pci_disconnect() Tuo Li
2021-08-11 6:59 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).