aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2018-12-18 22:28:21 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-19 08:29:28 +0100
commitb57f944785c5764725a7a6eff548a70bafb41a2a (patch)
treedc701f979db199147190778411fa6dc26decfd1c /drivers/staging
parentstaging: most: sound: replace snprintf with strscpy (diff)
downloadlinux-dev-b57f944785c5764725a7a6eff548a70bafb41a2a.tar.xz
linux-dev-b57f944785c5764725a7a6eff548a70bafb41a2a.zip
staging: fbtft: fix strncmp() size warning
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/fbtft/fbtft_device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 50e97da993e7..046f9d355ecb 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++)