Skip to content

Commit a8e8e39

Browse files
committed
Fix possible use of uninitialized variable.
device_tag_size variable was not initialized and used when device_is_nop_dif returned negative error code.
1 parent bcef385 commit a8e8e39

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/setup.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,11 @@ int crypt_format_inline(struct crypt_device *cd,
30453045
iparams->journal_integrity_key_size))
30463046
return -EINVAL;
30473047

3048-
if (!device_is_nop_dif(idevice, &device_tag_size)) {
3048+
r = device_is_nop_dif(idevice, &device_tag_size);
3049+
if (r < 0)
3050+
return r;
3051+
3052+
if (!r) {
30493053
log_err(cd, _("Device %s does not provide inline integrity data fields."), mdata_device_path(cd));
30503054
return -EINVAL;
30513055
}

0 commit comments

Comments
 (0)