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

libdm: fix condition

When we switch supported_reserved_types_with_range to const
gcc repots this problem:

 warning: ‘and’ of mutually exclusive equal-tests is always 0
 !(iter->type & supported_reserved_types_with_range))) {

It's not clear from the history what was the actual intention of this
internal error test, let's assume the check wanted to make sure
that when DM_REPORT_FIELD_RESERVED_VALUE_RANGE is set,
some other fields from supported_reserved_types_with_range set
are also selected.
This commit is contained in:
Zdenek Kabelac 2024-05-03 21:50:38 +02:00
parent 9b2f9d64c0
commit 2a1e200f7a
2 changed files with 8 additions and 4 deletions

View File

@ -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);
@ -2600,7 +2601,8 @@ static int _check_reserved_values_supported(const struct dm_report_field_type fi
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))) {
!(iter->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",

View File

@ -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);
@ -2598,7 +2599,8 @@ static int _check_reserved_values_supported(const struct dm_report_field_type fi
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))) {
!(iter->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",