Make it clear to Coverity that the tmp buffer in switch_ioscheduler() is \0-terminated
authorBart Van Assche <bart.vanassche@wdc.com>
Thu, 29 Mar 2018 15:24:23 +0000 (08:24 -0700)
committerBart Van Assche <bart.vanassche@wdc.com>
Thu, 29 Mar 2018 15:47:52 +0000 (08:47 -0700)
commit0e23d456e00d49b295dd3aeac59539fd9c6d97a7
tree54d36ae68ebdf0c36ae71a8bd06882d99f265ded
parentb348b7c7a1a6278d793698fc23993620ae9c588a
Make it clear to Coverity that the tmp buffer in switch_ioscheduler() is \0-terminated

The 'tmp' buffer used by switch_ioscheduler() will be '\0'-terminated
because the I/O scheduler name read from sysfs has much fewer characters
than the buffer size (256). Make it clear to Coverity that it is
guaranteed that the 'tmp' buffer is '\0'-terminated. Additionally, fix
the order of the fread() arguments. This patch fixes Coverity ID #24132.

Fixes: b44b9e45cf38 ("Clear sysfs path before reading current ioscheduler from sysfs")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
backend.c