]> www.infradead.org Git - users/sagi/blktests.git/commit
blktests: Fix compilation warning
authorDamien Le Moal <damien.lemoal@wdc.com>
Mon, 17 Dec 2018 05:51:08 +0000 (14:51 +0900)
committerOmar Sandoval <osandov@fb.com>
Tue, 18 Dec 2018 21:56:51 +0000 (13:56 -0800)
commit2ddd30d4a9a47003efc3ffb5edf8130691edc66c
treec167ffed9db33c70c5e9eeed08a2626737448f10
parentb0ef2aaa0f94ffe5a5f93bb2cb5e736eb757c8b4
blktests: Fix compilation warning

Fix strncpy length to "sizeof(buf) - 1" to avoid the compiler warning:
cc  -O2 -Wall -Wshadow  -o sg/syzkaller1 sg/syzkaller1.c
sg/syzkaller1.c: In function ‘syz_open_dev.constprop’:
sg/syzkaller1.c:204:16: warning: ‘strncpy’ specified bound 1024 equals
destination size [-Wstringop-truncation]
     NONFAILING(strncpy(buf, (char*)a0, sizeof(buf)));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sg/syzkaller1.c:143:7: note: in definition of macro ‘NONFAILING’
       __VA_ARGS__;                                                     \
       ^~~~~~~~~~~

Since the last character of buf is forced set to 0, there is no
functional change introduced by this patch.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
src/sg/syzkaller1.c