提交 82033bc5 编写于 作者: D Dan Carpenter 提交者: Mauro Carvalho Chehab

[media] mb86a20s: fix off by one checks

Clearly ">=" was intended here instead of ">".
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 c24e1371
...@@ -402,7 +402,7 @@ static int mb86a20s_get_modulation(struct mb86a20s_state *state, ...@@ -402,7 +402,7 @@ static int mb86a20s_get_modulation(struct mb86a20s_state *state,
[2] = 0x8e, /* Layer C */ [2] = 0x8e, /* Layer C */
}; };
if (layer > ARRAY_SIZE(reg)) if (layer >= ARRAY_SIZE(reg))
return -EINVAL; return -EINVAL;
rc = mb86a20s_writereg(state, 0x6d, reg[layer]); rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
if (rc < 0) if (rc < 0)
...@@ -435,7 +435,7 @@ static int mb86a20s_get_fec(struct mb86a20s_state *state, ...@@ -435,7 +435,7 @@ static int mb86a20s_get_fec(struct mb86a20s_state *state,
[2] = 0x8f, /* Layer C */ [2] = 0x8f, /* Layer C */
}; };
if (layer > ARRAY_SIZE(reg)) if (layer >= ARRAY_SIZE(reg))
return -EINVAL; return -EINVAL;
rc = mb86a20s_writereg(state, 0x6d, reg[layer]); rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
if (rc < 0) if (rc < 0)
...@@ -470,7 +470,7 @@ static int mb86a20s_get_interleaving(struct mb86a20s_state *state, ...@@ -470,7 +470,7 @@ static int mb86a20s_get_interleaving(struct mb86a20s_state *state,
[2] = 0x90, /* Layer C */ [2] = 0x90, /* Layer C */
}; };
if (layer > ARRAY_SIZE(reg)) if (layer >= ARRAY_SIZE(reg))
return -EINVAL; return -EINVAL;
rc = mb86a20s_writereg(state, 0x6d, reg[layer]); rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
if (rc < 0) if (rc < 0)
...@@ -494,7 +494,7 @@ static int mb86a20s_get_segment_count(struct mb86a20s_state *state, ...@@ -494,7 +494,7 @@ static int mb86a20s_get_segment_count(struct mb86a20s_state *state,
[2] = 0x91, /* Layer C */ [2] = 0x91, /* Layer C */
}; };
if (layer > ARRAY_SIZE(reg)) if (layer >= ARRAY_SIZE(reg))
return -EINVAL; return -EINVAL;
rc = mb86a20s_writereg(state, 0x6d, reg[layer]); rc = mb86a20s_writereg(state, 0x6d, reg[layer]);
if (rc < 0) if (rc < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册