]> asedeno.scripts.mit.edu Git - linux.git/commit
staging: fbtft: fix strncmp() size warning
authorYueHaibing <yuehaibing@huawei.com>
Tue, 18 Dec 2018 14:28:21 +0000 (22:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Dec 2018 07:29:28 +0000 (08:29 +0100)
commitb57f944785c5764725a7a6eff548a70bafb41a2a
treedc701f979db199147190778411fa6dc26decfd1c
parenta86028f8e3eea59517cb47895faad04b6ae8d8e1
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>
drivers/staging/fbtft/fbtft_device.c