From 6c4cd7b2f22a86a74f49104926ab96a24755e697 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 10 Sep 2021 23:02:09 +0200 Subject: cache: fix parentheses for migration_threshold When generating table line for cache target line, the estimation of added arguments was incorrectly calculated as the evaluation order of "?" is made after "+". However the result was 'masked' by the Reported-by: Jian Cai jcai19 --- libdm/libdm-deptree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdm') diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 06ebdc0c0..881558e44 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -2489,7 +2489,7 @@ static int _cache_emit_segment_line(struct dm_task *dmt, EMIT_PARAMS(pos, " %s", name); /* Do not pass migration_threshold 2048 which is default */ - EMIT_PARAMS(pos, " %u", (seg->policy_argc + (seg->migration_threshold != 2048) ? 1 : 0) * 2); + EMIT_PARAMS(pos, " %u", (seg->policy_argc + ((seg->migration_threshold != 2048) ? 1 : 0)) * 2); if (seg->migration_threshold != 2048) EMIT_PARAMS(pos, " migration_threshold %u", seg->migration_threshold); if (seg->policy_settings) -- cgit v1.2.1