* [PATCH] staging: rtl8192e: fix missing failure check on a call to dev_alloc_name
@ 2020-08-21 13:15 Colin King
2020-08-24 11:12 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-08-21 13:15 UTC (permalink / raw)
To: Greg Kroah-Hartman, wlanfae, Larry Finger, Mike McCormack, devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the second call to dev_alloc_name is not checking if this
failed. Add the check and perform necessary cleanup on an error.
Addresses-Coverity: ("Unchecked return value")
Fixes: 94a799425eee ("rtl8192e: Import new version of driver from realtek")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index fac58eebf263..7b15faeefff2 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2489,7 +2489,8 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
if (dev_alloc_name(dev, ifname) < 0) {
RT_TRACE(COMP_INIT,
"Oops: devname already taken! Trying wlan%%d...\n");
- dev_alloc_name(dev, ifname);
+ if (dev_alloc_name(dev, ifname) < 0)
+ goto err_unmap;
}
RT_TRACE(COMP_INIT, "Driver probe completed1\n");
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: rtl8192e: fix missing failure check on a call to dev_alloc_name
2020-08-21 13:15 [PATCH] staging: rtl8192e: fix missing failure check on a call to dev_alloc_name Colin King
@ 2020-08-24 11:12 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-08-24 11:12 UTC (permalink / raw)
To: Colin King
Cc: Greg Kroah-Hartman, wlanfae, Larry Finger, Mike McCormack, devel,
kernel-janitors, linux-kernel
On Fri, Aug 21, 2020 at 02:15:12PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the second call to dev_alloc_name is not checking if this
> failed. Add the check and perform necessary cleanup on an error.
>
> Addresses-Coverity: ("Unchecked return value")
> Fixes: 94a799425eee ("rtl8192e: Import new version of driver from realtek")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> index fac58eebf263..7b15faeefff2 100644
> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
> @@ -2489,7 +2489,8 @@ static int _rtl92e_pci_probe(struct pci_dev *pdev,
> if (dev_alloc_name(dev, ifname) < 0) {
^^^^^^
> RT_TRACE(COMP_INIT,
> "Oops: devname already taken! Trying wlan%%d...\n");
^^^^^^^
> - dev_alloc_name(dev, ifname);
^^^^^^
> + if (dev_alloc_name(dev, ifname) < 0)
The "ifname" is wrong. It was intended to be "wlan%d" or something like
the comment says. It will always fail. One potential is to just delete
this retest and assume that the user will fix their mistake and try
again. That's probably the best solution in fact.
> + goto err_unmap;
> }
if (dev_alloc_name(dev, ifname) < 0) {
RT_TRACE(COMP_INIT, "Oops: devname failed '%s'!\n", ifname);
goto err_unmap;
}
>
> RT_TRACE(COMP_INIT, "Driver probe completed1\n");
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-24 11:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-21 13:15 [PATCH] staging: rtl8192e: fix missing failure check on a call to dev_alloc_name Colin King
2020-08-24 11:12 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox