From: Riyan Dhiman <riyandhiman14@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Riyan Dhiman <riyandhiman14@gmail.com>
Subject: [PATCH] edd: Add null checks for edev and info in edd_get_pci_dev
Date: Wed, 4 Sep 2024 20:45:14 +0530 [thread overview]
Message-ID: <20240904151514.8962-1-riyandhiman14@gmail.com> (raw)
Add null check for edev in the edd_get_pci_dev function
to prevent potential null pointer dereference. This check ensure
that the function safely handles cases where edev might be NULL,
avoiding possible crashes.
Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
---
drivers/firmware/edd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 55dec4eb2c00..6964e528bf35 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -648,7 +648,10 @@ edd_dev_is_type(struct edd_device *edev, const char *type)
static struct pci_dev *
edd_get_pci_dev(struct edd_device *edev)
{
- struct edd_info *info = edd_dev_get_info(edev);
+ struct edd_info *info;
+ if(!edev)
+ return NULL;
+ info = edd_dev_get_info(edev);
if (edd_dev_is_type(edev, "PCI") || edd_dev_is_type(edev, "XPRS")) {
return pci_get_domain_bus_and_slot(0,
--
2.46.0
reply other threads:[~2024-09-04 15:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240904151514.8962-1-riyandhiman14@gmail.com \
--to=riyandhiman14@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®