[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20170725195255.ahyphfpjklnjrov3@mwanda>
Date: Tue, 25 Jul 2017 22:52:55 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Len Brown <len.brown@...el.com>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] tools/power x86_energy_perf_policy: fix shift wrapping bug
"pkg" goes up to 63 so there is a potential shift wrapping bug here.
Fixes: 4beec1d75196 ("tools/power x86_energy_perf_policy: support HWP.EPP")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
index 65bbe627a425..ad792cfbdc90 100644
--- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
+++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
@@ -483,7 +483,7 @@ void parse_cmdline_pkg(char *s)
while (pkg <= end_pkg) {
if (pkg > max_pkg_num)
errx(1, "Requested pkg%d exceeds max pkg%d", pkg, max_pkg_num);
- pkg_selected_set |= 1 << pkg;
+ pkg_selected_set |= 1ULL << pkg;
pkg++;
}
startp = endp;
@@ -498,7 +498,7 @@ void parse_cmdline_pkg(char *s)
pkg = strtol(startp, &endp, 10);
if (pkg > max_pkg_num)
errx(1, "Requested pkg%d Exceeds max pkg%d", pkg, max_pkg_num);
- pkg_selected_set |= 1 << pkg;
+ pkg_selected_set |= 1ULL << pkg;
startp = endp;
}
}
Powered by blists - more mailing lists