From: YueHaibing <yuehaibing@huawei.com>
To: <devel@driverdev.osuosl.org>, <gregkh@linuxfoundation.org>,
<leobras.c@gmail.co>, <radek.dostal@streamunlimited.co>
Cc: <linux-kernel@vger.kernel.org>, <linux-fbdev@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>,
YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH v2 -next] staging: fbtft: use strcmp() instead of strncmp() for
Date: Tue, 18 Dec 2018 21:25:08 +0800 [thread overview]
Message-ID: <20181218132508.18672-1-yuehaibing@huawei.com> (raw)
strncmp() stops comparing when either the end of one of the first two
arguments is reached or when 'n' characters have been compared, whichever
comes first.That means that strncmp(s1, s2, n) is equivalent to
strcmp(s1, s2) if n exceeds the length of s1 or the length of s2.
This patch avoids that the following warning is reported by smatch:
drivers/staging/fbtft/fbtft_device.c:1458
fbtft_device_init() error: strncmp() '"list"' too small (5 vs 32)
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: fix patch title
---
drivers/staging/fbtft/fbtft_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 50e97da..0e995028 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -1455,7 +1455,7 @@ static int __init fbtft_device_init(void)
}
/* name=list lists all supported displays */
- if (strncmp(name, "list", FBTFT_GPIO_NAME_SIZE) == 0) {
+ if (strcmp(name, "list") == 0) {
pr_info("Supported displays:\n");
for (i = 0; i < ARRAY_SIZE(displays); i++)
--
2.7.0
next reply other threads:[~2018-12-18 13:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-18 13:25 YueHaibing [this message]
2018-12-18 13:37 ` Dan Carpenter
2018-12-18 13:46 ` YueHaibing
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=20181218132508.18672-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=devel@driverdev.osuosl.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=leobras.c@gmail.co \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=radek.dostal@streamunlimited.co \
/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®