From: Thorsten Blum <thorsten.blum@linux.dev>
To: Aaro Koskinen <aaro.koskinen@iki.fi>,
Andreas Kemnade <andreas@kemnade.info>,
Kevin Hilman <khilman@baylibre.com>,
Roger Quadros <rogerq@kernel.org>,
Tony Lindgren <tony@atomide.com>,
Russell King <linux@armlinux.org.uk>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] ARM: OMAP2: use snprintf() in multiple check revision functions
Date: Thu, 23 Apr 2026 19:10:17 +0200 [thread overview]
Message-ID: <20260423171016.275157-5-thorsten.blum@linux.dev> (raw)
Replace unbounded sprintf() calls with the safer snprintf() in multiple
*_check_revision() functions.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/arm/mach-omap2/id.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index cf2bfb447ee2..44d7471666a8 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -192,8 +192,8 @@ void __init omap2xxx_check_revision(void)
j = i;
}
- sprintf(soc_name, "OMAP%04x", omap_rev() >> 16);
- sprintf(soc_rev, "ES%x", (omap_rev() >> 12) & 0xf);
+ snprintf(soc_name, sizeof(soc_name), "OMAP%04x", omap_rev() >> 16);
+ snprintf(soc_rev, sizeof(soc_rev), "ES%x", (omap_rev() >> 12) & 0xf);
pr_info("%s", soc_name);
if ((omap_rev() >> 8) & 0x0f)
@@ -519,7 +519,7 @@ void __init omap3xxx_check_revision(void)
pr_warn("Warning: unknown chip type: hawkeye %04x, assuming OMAP3630ES1.2\n",
hawkeye);
}
- sprintf(soc_rev, "ES%s", cpu_rev);
+ snprintf(soc_rev, sizeof(soc_rev), "ES%s", cpu_rev);
}
void __init omap4xxx_check_revision(void)
@@ -594,9 +594,9 @@ void __init omap4xxx_check_revision(void)
omap_revision = OMAP4430_REV_ES2_3;
}
- sprintf(soc_name, "OMAP%04x", omap_rev() >> 16);
- sprintf(soc_rev, "ES%d.%d", (omap_rev() >> 12) & 0xf,
- (omap_rev() >> 8) & 0xf);
+ snprintf(soc_name, sizeof(soc_name), "OMAP%04x", omap_rev() >> 16);
+ snprintf(soc_rev, sizeof(soc_rev), "ES%d.%d", (omap_rev() >> 12) & 0xf,
+ (omap_rev() >> 8) & 0xf);
pr_info("%s %s\n", soc_name, soc_rev);
}
@@ -637,8 +637,8 @@ void __init omap5xxx_check_revision(void)
omap_revision = OMAP5430_REV_ES2_0;
}
- sprintf(soc_name, "OMAP%04x", omap_rev() >> 16);
- sprintf(soc_rev, "ES%d.0", (omap_rev() >> 12) & 0xf);
+ snprintf(soc_name, sizeof(soc_name), "OMAP%04x", omap_rev() >> 16);
+ snprintf(soc_rev, sizeof(soc_rev), "ES%d.0", (omap_rev() >> 12) & 0xf);
pr_info("%s %s\n", soc_name, soc_rev);
}
@@ -712,9 +712,9 @@ void __init dra7xxx_check_revision(void)
omap_revision = DRA752_REV_ES2_0;
}
- sprintf(soc_name, "DRA%03x", omap_rev() >> 16);
- sprintf(soc_rev, "ES%d.%d", (omap_rev() >> 12) & 0xf,
- (omap_rev() >> 8) & 0xf);
+ snprintf(soc_name, sizeof(soc_name), "DRA%03x", omap_rev() >> 16);
+ snprintf(soc_rev, sizeof(soc_rev), "ES%d.%d", (omap_rev() >> 12) & 0xf,
+ (omap_rev() >> 8) & 0xf);
pr_info("%s %s\n", soc_name, soc_rev);
}
next reply other threads:[~2026-04-23 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 17:10 Thorsten Blum [this message]
2026-04-23 17:10 ` [PATCH 2/4] ARM: OMAP2: use sysfs_emit() in type_show Thorsten Blum
2026-04-23 17:10 ` [PATCH 3/4] ARM: OMAP2: clean up string copying and formatting in omap3_cpuinfo Thorsten Blum
2026-04-23 17:10 ` [PATCH 4/4] ARM: OMAP2: zero-initialize local buffer " Thorsten Blum
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=20260423171016.275157-5-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=aaro.koskinen@iki.fi \
--cc=andreas@kemnade.info \
--cc=khilman@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=rogerq@kernel.org \
--cc=tony@atomide.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