提交 428ed14f 编写于 作者: D Dan Carpenter 提交者: Greg Kroah-Hartman

Staging: ced1401: fix a couple off by one checks

nArea is used as an offset into the ->rTransDef[] array which has
MAX_TRANSAREAS elements.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 bff6c3e0
...@@ -837,7 +837,7 @@ int SetEvent(DEVICE_EXTENSION * pdx, TRANSFEREVENT __user * pTE) ...@@ -837,7 +837,7 @@ int SetEvent(DEVICE_EXTENSION * pdx, TRANSFEREVENT __user * pTE)
int WaitEvent(DEVICE_EXTENSION * pdx, int nArea, int msTimeOut) int WaitEvent(DEVICE_EXTENSION * pdx, int nArea, int msTimeOut)
{ {
int iReturn; int iReturn;
if ((unsigned)nArea > MAX_TRANSAREAS) if ((unsigned)nArea >= MAX_TRANSAREAS)
return U14ERR_BADAREA; return U14ERR_BADAREA;
else { else {
int iWait; int iWait;
...@@ -884,7 +884,7 @@ int WaitEvent(DEVICE_EXTENSION * pdx, int nArea, int msTimeOut) ...@@ -884,7 +884,7 @@ int WaitEvent(DEVICE_EXTENSION * pdx, int nArea, int msTimeOut)
int TestEvent(DEVICE_EXTENSION * pdx, int nArea) int TestEvent(DEVICE_EXTENSION * pdx, int nArea)
{ {
int iReturn; int iReturn;
if ((unsigned)nArea > MAX_TRANSAREAS) if ((unsigned)nArea >= MAX_TRANSAREAS)
iReturn = U14ERR_BADAREA; iReturn = U14ERR_BADAREA;
else { else {
TRANSAREA *pTA = &pdx->rTransDef[nArea]; TRANSAREA *pTA = &pdx->rTransDef[nArea];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册