From 00cfe3a24eea9f0c5790f4d996914218dc9ab897 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 10 May 2024 13:53:11 +0200 Subject: [PATCH] libdm: reapply "fix condition" This reverts commit d16a8f80e9dd21d97b10056858a21b7e8fbd8c94. So the correction was OK, however we missed to fix also cut&paste bug here - as the second check should be actually checking field->type. --- device_mapper/libdm-report.c | 8 +++++--- libdm/libdm-report.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/device_mapper/libdm-report.c b/device_mapper/libdm-report.c index 86c95e109..0506ba47f 100644 --- a/device_mapper/libdm-report.c +++ b/device_mapper/libdm-report.c @@ -2589,7 +2589,8 @@ static int _check_reserved_values_supported(const struct dm_report_field_type fi if (iter->type & DM_REPORT_FIELD_TYPE_MASK) { if (!(iter->type & supported_reserved_types) || ((iter->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE) && - !(iter->type & supported_reserved_types_with_range))) { + !(iter->type & (supported_reserved_types_with_range & + ~DM_REPORT_FIELD_RESERVED_VALUE_RANGE)))) { log_error(INTERNAL_ERROR "_check_reserved_values_supported: " "global reserved value for type 0x%x not supported", iter->type); @@ -2599,8 +2600,9 @@ static int _check_reserved_values_supported(const struct dm_report_field_type fi field_res = (const struct dm_report_field_reserved_value *) iter->value; field = &fields[field_res->field_num]; if (!(field->flags & supported_reserved_types) || - ((iter->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE) && - !(iter->type & supported_reserved_types_with_range))) { + ((field->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE) && + !(field->type & (supported_reserved_types_with_range & + ~DM_REPORT_FIELD_RESERVED_VALUE_RANGE)))) { log_error(INTERNAL_ERROR "_check_reserved_values_supported: " "field-specific reserved value of type 0x%x for " "field %s not supported", diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index d6a01060f..78d08b234 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -2587,7 +2587,8 @@ static int _check_reserved_values_supported(const struct dm_report_field_type fi if (iter->type & DM_REPORT_FIELD_TYPE_MASK) { if (!(iter->type & supported_reserved_types) || ((iter->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE) && - !(iter->type & supported_reserved_types_with_range))) { + !(iter->type & (supported_reserved_types_with_range & + ~DM_REPORT_FIELD_RESERVED_VALUE_RANGE)))) { log_error(INTERNAL_ERROR "_check_reserved_values_supported: " "global reserved value for type 0x%x not supported", iter->type); @@ -2597,8 +2598,9 @@ static int _check_reserved_values_supported(const struct dm_report_field_type fi field_res = (const struct dm_report_field_reserved_value *) iter->value; field = &fields[field_res->field_num]; if (!(field->flags & supported_reserved_types) || - ((iter->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE) && - !(iter->type & supported_reserved_types_with_range))) { + ((field->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE) && + !(field->type & (supported_reserved_types_with_range & + ~DM_REPORT_FIELD_RESERVED_VALUE_RANGE)))) { log_error(INTERNAL_ERROR "_check_reserved_values_supported: " "field-specific reserved value of type 0x%x for " "field %s not supported",