mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 11:04:44 +08:00
drm/i915/gvt: fix a bounds check in ring_id_to_context_switch_event()
There are two bugs here. The && should be || and the > is off by one so
it should be >= ARRAY_SIZE().
Fixes: 8453d674ae
("drm/i915/gvt: vGPU execlist virtualization")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
This commit is contained in:
parent
5ad59bf096
commit
c821ee6d2b
@ -56,8 +56,8 @@ static int context_switch_events[] = {
|
|||||||
|
|
||||||
static int ring_id_to_context_switch_event(int ring_id)
|
static int ring_id_to_context_switch_event(int ring_id)
|
||||||
{
|
{
|
||||||
if (WARN_ON(ring_id < RCS && ring_id >
|
if (WARN_ON(ring_id < RCS ||
|
||||||
ARRAY_SIZE(context_switch_events)))
|
ring_id >= ARRAY_SIZE(context_switch_events)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return context_switch_events[ring_id];
|
return context_switch_events[ring_id];
|
||||||
|
Loading…
Reference in New Issue
Block a user