提交 edbdabc6 编写于 作者: A Adam Lessnau 提交者: Rafael J. Wysocki

powercap/RAPL: prevent overridding bits outside of the mask

Fixes wrong bits shift operation in the rapl_write_data_raw function, which
might cause overridding bits outside of the mask.

For example, writing new TIME_WINDOW1 value can override POWER_LIMIT1.
Signed-off-by: NAdam Lessnau <adam.lessnau@intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 c0bc126f
......@@ -874,7 +874,9 @@ static int rapl_write_data_raw(struct rapl_domain *rd,
cpu = rd->rp->lead_cpu;
bits = rapl_unit_xlate(rd, rp->unit, value, 1);
bits |= bits << rp->shift;
bits <<= rp->shift;
bits &= rp->mask;
memset(&ma, 0, sizeof(ma));
ma.msr_no = rd->msrs[rp->id];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册