]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet: use strcmp() instead of strncmp() for subsystem lookup
authorBart Van Assche <bvanassche@acm.org>
Mon, 8 Oct 2018 21:28:49 +0000 (14:28 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 17 Oct 2018 06:58:24 +0000 (08:58 +0200)
commit7fbc0d6cca2f76f6b25f1f40aa77ba9e8c84bbc6
treeaac607454840ce2ebe94f20e982642ccbc906bd1
parent5771de81e7d3a8ae80d22559c10ea88482fb6893
nvmet: use strcmp() instead of strncmp() for subsystem lookup

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. Since that is the case in
nvmet_find_get_subsys(), change strncmp() into strcmp(). This patch avoids that
the following warning is reported by smatch:

drivers/nvme/target/core.c:940:1 nvmet_find_get_subsys() error: strncmp() '"nqn.2014-08.org.nvmexpress.discovery"' too small (37 vs 223)

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/core.c