From: David Wang <00107082@163.com>
To: tglx@linutronix.de
Cc: kees@kernel.org, linux-kernel@vger.kernel.org,
geert@linux-m68k.org, David Wang <00107082@163.com>
Subject: [PATCH 2/3] irqchip: Fix a potential abuse of seq_printf() format string
Date: Wed, 20 Nov 2024 17:17:06 +0800 [thread overview]
Message-ID: <762e88c3e940bd6087c35b599f2c88baff775c6b.1732093745.git.00107082@163.com> (raw)
In-Reply-To: <505e5950dd2d76e6c3a8af57bc0cd1e0fbf2b637.1732093745.git.00107082@163.com>
Using device name as format string of seq_printf() is prone to
"Format string attack", opens possibility for exploitation.
Seq_puts() is safer and more efficient.
Signed-off-by: David Wang <00107082@163.com>
---
drivers/irqchip/irq-gic.c | 2 +-
drivers/irqchip/irq-mvebu-pic.c | 2 +-
drivers/irqchip/irq-versatile-fpga.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 3be7bd8cd8cd..8fae6dc01024 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -400,7 +400,7 @@ static void gic_irq_print_chip(struct irq_data *d, struct seq_file *p)
struct gic_chip_data *gic = irq_data_get_irq_chip_data(d);
if (gic->domain->pm_dev)
- seq_printf(p, gic->domain->pm_dev->of_node->name);
+ seq_puts(p, gic->domain->pm_dev->of_node->name);
else
seq_printf(p, "GIC-%d", (int)(gic - &gic_data[0]));
}
diff --git a/drivers/irqchip/irq-mvebu-pic.c b/drivers/irqchip/irq-mvebu-pic.c
index 08b0cc862adf..b815a60f930c 100644
--- a/drivers/irqchip/irq-mvebu-pic.c
+++ b/drivers/irqchip/irq-mvebu-pic.c
@@ -71,7 +71,7 @@ static void mvebu_pic_print_chip(struct irq_data *d, struct seq_file *p)
{
struct mvebu_pic *pic = irq_data_get_irq_chip_data(d);
- seq_printf(p, dev_name(&pic->pdev->dev));
+ seq_puts(p, dev_name(&pic->pdev->dev));
}
static const struct irq_chip mvebu_pic_chip = {
diff --git a/drivers/irqchip/irq-versatile-fpga.c b/drivers/irqchip/irq-versatile-fpga.c
index ca471c6fee99..0abc8934c2ee 100644
--- a/drivers/irqchip/irq-versatile-fpga.c
+++ b/drivers/irqchip/irq-versatile-fpga.c
@@ -69,7 +69,7 @@ static void fpga_irq_print_chip(struct irq_data *d, struct seq_file *p)
{
struct fpga_irq_data *f = irq_data_get_irq_chip_data(d);
- seq_printf(p, irq_domain_get_of_node(f->domain)->name);
+ seq_puts(p, irq_domain_get_of_node(f->domain)->name);
}
static const struct irq_chip fpga_chip = {
--
2.39.2
next prev parent reply other threads:[~2024-11-20 9:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-20 9:14 [PATCH 1/3] gpio: Fix a potential abuse of seq_printf() format string David Wang
2024-11-20 9:17 ` David Wang [this message]
2024-12-03 11:22 ` [PATCH 2/3] irqchip: " Thomas Gleixner
2024-12-03 12:00 ` David Wang
2024-11-20 9:18 ` [PATCH 3/3] pinctrl: " David Wang
2024-11-20 11:04 ` [PATCH 1/3] gpio: " Geert Uytterhoeven
2024-11-20 11:41 ` David 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=762e88c3e940bd6087c35b599f2c88baff775c6b.1732093745.git.00107082@163.com \
--to=00107082@163.com \
--cc=geert@linux-m68k.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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