1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: hide false positive warning

Here we have valid use case of strncpy() which just need
to fill precise buffer size - so no explicit \0 on buffer
end is needed.
This commit is contained in:
Zdenek Kabelac 2021-09-10 09:58:26 +02:00
parent 63930f576a
commit a14371e495
3 changed files with 5 additions and 0 deletions

View File

@ -2989,6 +2989,7 @@ static int add_lockspace_thread(const char *ls_name,
}
if (vg_uuid)
/* coverity[buffer_size_warning] */
strncpy(ls->vg_uuid, vg_uuid, 64);
if (vg_name)

View File

@ -1250,9 +1250,11 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
/* FIXME Until resume ioctl supplies name, use dev_name for readahead */
if (DEV_NAME(dmt) && (dmt->type != DM_DEVICE_RESUME || dmt->minor < 0 ||
dmt->major < 0))
/* coverity[buffer_size_warning] */
strncpy(dmi->name, DEV_NAME(dmt), sizeof(dmi->name));
if (DEV_UUID(dmt))
/* coverity[buffer_size_warning] */
strncpy(dmi->uuid, DEV_UUID(dmt), sizeof(dmi->uuid));
if (dmt->type == DM_DEVICE_SUSPEND)

View File

@ -1245,9 +1245,11 @@ static struct dm_ioctl *_flatten(struct dm_task *dmt, unsigned repeat_count)
(dmt->minor < 0) || (dmt->major < 0)))
/* When RESUME or RELOAD sets maj:min and dev_name, use just maj:min,
* passed dev_name is useful for better error/debug messages */
/* coverity[buffer_size_warning] */
strncpy(dmi->name, DEV_NAME(dmt), sizeof(dmi->name));
if (DEV_UUID(dmt))
/* coverity[buffer_size_warning] */
strncpy(dmi->uuid, DEV_UUID(dmt), sizeof(dmi->uuid));
if (dmt->type == DM_DEVICE_SUSPEND)