[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260203230758.3056-2-iprintercanon@gmail.com>
Date: Tue, 3 Feb 2026 23:07:56 +0000
From: Artem Lytkin <iprintercanon@...il.com>
To: Sudip Mukherjee <sudipm.mukherjee@...il.com>,
Teddy Wang <teddy.wang@...iconmotion.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-fbdev@...r.kernel.org,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Artem Lytkin <iprintercanon@...il.com>
Subject: [PATCH 2/4] staging: sm750fb: use strcmp() for exact option matching
Replace strncmp(opt, "...", strlen("...")) with strcmp() in option
parsing functions. Options from strsep() are complete null-terminated
tokens, so prefix matching via strncmp() could cause false positives
for options like "noaccelXYZ" matching "noaccel".
Signed-off-by: Artem Lytkin <iprintercanon@...il.com>
---
drivers/staging/sm750fb/sm750.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 4c6e84c03..bd2d4a290 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -937,21 +937,21 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
dev_info(&sm750_dev->pdev->dev, "opt=%s\n", opt);
dev_info(&sm750_dev->pdev->dev, "src=%s\n", src);
- if (!strncmp(opt, "swap", strlen("swap"))) {
+ if (!strcmp(opt, "swap")) {
swap = 1;
- } else if (!strncmp(opt, "nocrt", strlen("nocrt"))) {
+ } else if (!strcmp(opt, "nocrt")) {
sm750_dev->nocrt = 1;
- } else if (!strncmp(opt, "36bit", strlen("36bit"))) {
+ } else if (!strcmp(opt, "36bit")) {
sm750_dev->pnltype = sm750_doubleTFT;
- } else if (!strncmp(opt, "18bit", strlen("18bit"))) {
+ } else if (!strcmp(opt, "18bit")) {
sm750_dev->pnltype = sm750_dualTFT;
- } else if (!strncmp(opt, "24bit", strlen("24bit"))) {
+ } else if (!strcmp(opt, "24bit")) {
sm750_dev->pnltype = sm750_24TFT;
- } else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) {
+ } else if (!strcmp(opt, "nohwc0")) {
g_hwcursor &= ~0x1;
- } else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) {
+ } else if (!strcmp(opt, "nohwc1")) {
g_hwcursor &= ~0x2;
- } else if (!strncmp(opt, "nohwc", strlen("nohwc"))) {
+ } else if (!strcmp(opt, "nohwc")) {
g_hwcursor = 0;
} else {
if (!g_fbmode[0]) {
@@ -1156,11 +1156,11 @@ static int __init lynxfb_setup(char *options)
*/
while ((opt = strsep(&options, ":")) != NULL) {
/* options that mean for any lynx chips are configured here */
- if (!strncmp(opt, "noaccel", strlen("noaccel"))) {
+ if (!strcmp(opt, "noaccel")) {
g_noaccel = 1;
- } else if (!strncmp(opt, "nomtrr", strlen("nomtrr"))) {
+ } else if (!strcmp(opt, "nomtrr")) {
g_nomtrr = 1;
- } else if (!strncmp(opt, "dual", strlen("dual"))) {
+ } else if (!strcmp(opt, "dual")) {
g_dualview = 1;
} else {
memcpy(tmp, opt, strlen(opt));
--
2.43.0
Powered by blists - more mailing lists