Skip to content

Commit 1aeb6e7

Browse files
damien-lemoalsnitm
authored andcommitted
dm ioctl: Fix compilation warning
In retrieve_status(), when copying the target type name in the target_type string field of struct dm_target_spec, copy at most DM_MAX_TYPE_NAME - 1 character to avoid the compilation warning: warning: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Wstringop-truncation] when compiling with W-1. Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 04dc533 commit 1aeb6e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/dm-ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ static void retrieve_status(struct dm_table *table,
11681168
spec->sector_start = ti->begin;
11691169
spec->length = ti->len;
11701170
strncpy(spec->target_type, ti->type->name,
1171-
sizeof(spec->target_type));
1171+
sizeof(spec->target_type) - 1);
11721172

11731173
outptr += sizeof(struct dm_target_spec);
11741174
remaining = len - (outptr - outbuf);

0 commit comments

Comments
 (0)