Skip to content

Commit

Permalink
s390/dasd: fix gcc 8 stringop-truncation warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vasily Gorbik authored and Martin Schwidefsky committed Jul 2, 2018
1 parent c6756b7 commit 4e0f5e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/s390/block/dasd_alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e0f5e9

Please sign in to comment.