mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
mei: fix out of array access to me clients array
The patch 9f81abdac3
: "mei: implement mei_cl_connect function"
from Jan 8, 2013, leads to the following static checker warning:
"drivers/misc/mei/main.c:522 mei_ioctl_connect_client()
warn: check 'dev->me_clients[]' for negative offsets (-2)"
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
221ba15173
commit
46e0cd87d9
@ -489,10 +489,15 @@ static int mei_ioctl_connect_client(struct file *file,
|
|||||||
|
|
||||||
/* find ME client we're trying to connect to */
|
/* find ME client we're trying to connect to */
|
||||||
i = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
|
i = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
|
||||||
if (i >= 0 && !dev->me_clients[i].props.fixed_address) {
|
if (i < 0 || dev->me_clients[i].props.fixed_address) {
|
||||||
|
dev_dbg(&dev->pdev->dev, "Cannot connect to FW Client UUID = %pUl\n",
|
||||||
|
&data->in_client_uuid);
|
||||||
|
rets = -ENODEV;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
cl->me_client_id = dev->me_clients[i].client_id;
|
cl->me_client_id = dev->me_clients[i].client_id;
|
||||||
cl->state = MEI_FILE_CONNECTING;
|
cl->state = MEI_FILE_CONNECTING;
|
||||||
}
|
|
||||||
|
|
||||||
dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n",
|
dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n",
|
||||||
cl->me_client_id);
|
cl->me_client_id);
|
||||||
@ -527,11 +532,6 @@ static int mei_ioctl_connect_client(struct file *file,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl->state != MEI_FILE_CONNECTING) {
|
|
||||||
rets = -ENODEV;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* prepare the output buffer */
|
/* prepare the output buffer */
|
||||||
client = &data->out_client_properties;
|
client = &data->out_client_properties;
|
||||||
@ -543,7 +543,6 @@ static int mei_ioctl_connect_client(struct file *file,
|
|||||||
rets = mei_cl_connect(cl, file);
|
rets = mei_cl_connect(cl, file);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
dev_dbg(&dev->pdev->dev, "free connect cb memory.");
|
|
||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user