• Vasily Gorbik's avatar
    s390: fix gcc 8 stringop-truncation warnings in proc handlers · f6ea4d25
    Vasily Gorbik authored
    arch/s390/kernel/topology.c:591:3: warning: 'strncpy' output truncated
    before terminating nul copying 2 bytes from a string of the same length
    [-Wstringop-truncation]
       strncpy(buf, topology_is_enabled() ? "1\n" : "0\n", ARRAY_SIZE(buf));
    
    arch/s390/appldata/appldata_base.c:326:3: warning: 'strncpy' output truncated
    before terminating nul copying 2 bytes from a string of the same length
    [-Wstringop-truncation]
       strncpy(buf, ops->active ? "1\n" : "0\n", ARRAY_SIZE(buf));
    
    arch/s390/appldata/appldata_base.c:217:3: warning: 'strncpy' output truncated
    before terminating nul copying 2 bytes from a string of the same length
    [-Wstringop-truncation]
       strncpy(buf, appldata_timer_active ? "1\n" : "0\n", ARRAY_SIZE(buf));
    
    To avoid the warning, just reuse memcpy.
    Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    f6ea4d25
topology.c 14.3 KB