From 1705b439b1babfcae75b1d54d45eb7909cbccfb9 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 29 Aug 2020 19:56:37 +0200 Subject: [PATCH] cov: always sure we end with '0' Use easier dm_strncpy(). --- lib/label/hints.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/label/hints.c b/lib/label/hints.c index 3125ae01d..c9d339861 100644 --- a/lib/label/hints.c +++ b/lib/label/hints.c @@ -818,8 +818,7 @@ static int _read_hint_file(struct cmd_context *cmd, struct dm_list *hints, int * while ((dev = dev_iter_get(cmd, iter))) { if (!_dev_in_hint_hash(cmd, dev)) continue; - memset(devpath, 0, sizeof(devpath)); - strncpy(devpath, dev_name(dev), PATH_MAX); + (void) dm_strncpy(devpath, dev_name(dev), sizeof(devpath)); calc_hash = calc_crc(calc_hash, (const uint8_t *)devpath, strlen(devpath)); calc_count++; }