public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	wlanfae <wlanfae@realtek.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Mike McCormack <mikem@ring3k.org>,
	devel@driverdev.osuosl.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: rtl8192e: fix missing failure check on a call to dev_alloc_name
Date: Fri, 21 Aug 2020 13:15:12 +0000	[thread overview]
Message-ID: <20200821131512.348775-1-colin.king@canonical.com> (raw)

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

             reply	other threads:[~2020-08-21 13:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 13:15 Colin King [this message]
2020-08-24 11:12 ` [PATCH] staging: rtl8192e: fix missing failure check on a call to dev_alloc_name Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200821131512.348775-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikem@ring3k.org \
    --cc=wlanfae@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox