From: Ruoyu Wang <ruoyuw560@gmail.com>
To: Dave Penkler <dpenkler@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ruoyu Wang <ruoyuw560@gmail.com>
Subject: [PATCH 1/2] gpib: ines: check CIS register mapping
Date: Sun, 7 Jun 2026 17:34:44 +0800 [thread overview]
Message-ID: <20260607093445.3-2-ruoyuw560@gmail.com> (raw)
In-Reply-To: <20260607093445.3-1-ruoyuw560@gmail.com>
ines_gpib_config() maps the PCMCIA attribute-memory window and then
writes the I/O window base through the returned pointer. If ioremap()
fails, the writeb() dereferences a NULL mapping.
Check the mapping result and unwind the partially configured device
before returning -ENOMEM.
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
drivers/gpib/ines/ines_gpib.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpib/ines/ines_gpib.c b/drivers/gpib/ines/ines_gpib.c
index c000f647f..0968a247e 100644
--- a/drivers/gpib/ines/ines_gpib.c
+++ b/drivers/gpib/ines/ines_gpib.c
@@ -1145,6 +1145,10 @@ static int ines_gpib_config(struct pcmcia_device *link)
return -ENODEV;
}
virt = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
+ if (!virt) {
+ ines_gpib_release(link);
+ return -ENOMEM;
+ }
writeb((link->resource[2]->start >> 2) & 0xff, virt + 0xf0); // IOWindow base
iounmap(virt);
--
2.51.0
next prev parent reply other threads:[~2026-06-07 9:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 9:34 [PATCH 0/2] gpib: check register mappings Ruoyu Wang
2026-06-07 9:34 ` Ruoyu Wang [this message]
2026-06-07 9:34 ` [PATCH 2/2] gpib: agilent_82350b: " Ruoyu Wang
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=20260607093445.3-2-ruoyuw560@gmail.com \
--to=ruoyuw560@gmail.com \
--cc=dpenkler@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®