s390/dasd: fix gcc 8 stringop-truncation warning
authorVasily Gorbik <gor@linux.ibm.com>
Sun, 17 Jun 2018 10:18:56 +0000 (12:18 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 2 Jul 2018 09:24:53 +0000 (11:24 +0200)
drivers/s390/block/dasd_alias.c:711:2: warning: 'strncpy' output truncated
before terminating nul copying 4 bytes from a string of the same length
[-Wstringop-truncation]
  strncpy((char *) &cqr->magic, "ECKD", 4);

Replace strncpy to int as a buffer with memcpy.

Acked-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd_alias.c

index e36a114354fc368e2141aae5c080c7f61b674da8..b9ce93e9df89295eb72132fcfc81d0257aaa1723 100644 (file)
@@ -708,7 +708,7 @@ static int reset_summary_unit_check(struct alias_lcu *lcu,
        struct ccw1 *ccw;
 
        cqr = lcu->rsu_cqr;
-       strncpy((char *) &cqr->magic, "ECKD", 4);
+       memcpy((char *) &cqr->magic, "ECKD", 4);
        ASCEBC((char *) &cqr->magic, 4);
        ccw = cqr->cpaddr;
        ccw->cmd_code = DASD_ECKD_CCW_RSCK;