summaryrefslogtreecommitdiff
path: root/futility/updater.c
diff options
context:
space:
mode:
Diffstat (limited to 'futility/updater.c')
-rw-r--r--futility/updater.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/futility/updater.c b/futility/updater.c
index 01aa13af..7536093f 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -953,8 +953,6 @@ static int preserve_gbb(const struct firmware_image *image_from,
struct firmware_image *image_to,
int preserve_flags)
{
- int len;
- uint8_t *hwid_to, *hwid_from;
const struct vb2_gbb_header *gbb_from;
struct vb2_gbb_header *gbb_to;
@@ -969,18 +967,9 @@ static int preserve_gbb(const struct firmware_image *image_from,
if (preserve_flags)
gbb_to->flags = gbb_from->flags;
- hwid_to = (uint8_t *)gbb_to + gbb_to->hwid_offset;
- hwid_from = (uint8_t *)gbb_from + gbb_from->hwid_offset;
-
/* Preserve HWID. */
- len = strlen((const char *)hwid_from);
- if (len >= gbb_to->hwid_size)
- return -1;
-
- /* Zero whole area so we won't have garbage after NUL. */
- memset(hwid_to, 0, gbb_to->hwid_size);
- memcpy(hwid_to, hwid_from, len);
- return 0;
+ return vb2_change_hwid(
+ gbb_to, (const char *)gbb_from + gbb_from->hwid_offset);
}
/*