radio: iris: Use kernel API to copy data from user space

Use copy_from_user kernel api to copy any data from user space
to kernel space.

Bug: 28769546
Change-Id: Ia3b7bb0f98180bd8792c1c18e930cb5609b8dc82
CRs-Fixed: 540320
Signed-off-by: Ayaz Ahmad <aahmad@codeaurora.org>
Signed-off-by: Siqi Lin <siqilin@google.com>
This commit is contained in:
Ayaz Ahmad 2013-10-08 15:56:04 +05:30 committed by Siqi Lin
parent 33e340a008
commit d9809ae397

View file

@ -3373,13 +3373,21 @@ static int iris_vidioc_s_ctrl(struct file *file, void *priv,
break;
case V4L2_CID_PRIVATE_IRIS_RIVA_POKE:
if (radio->riva_data_req.cmd_params.length <= MAX_RIVA_PEEK_RSP_SIZE) {
memcpy(radio->riva_data_req.data, (void *)ctrl->value,
retval = copy_from_user(radio->riva_data_req.data,
(void *)ctrl->value,
radio->riva_data_req.cmd_params.length);
radio->riva_data_req.cmd_params.subopcode = RIVA_POKE_OPCODE;
retval = hci_poke_data(&radio->riva_data_req , radio->fm_hdev);
if (retval == 0) {
radio->riva_data_req.cmd_params.subopcode =
RIVA_POKE_OPCODE;
retval = hci_poke_data(&radio->riva_data_req,
radio->fm_hdev);
} else {
retval = -EINVAL;
}
} else {
FMDERR("Can not copy into driver's buffer. Length %d is more than"
"the buffer size %d\n", ctrl->value, MAX_RIVA_PEEK_RSP_SIZE);
"the buffer size %d\n", radio->riva_data_req.cmd_params.length,
MAX_RIVA_PEEK_RSP_SIZE);
retval = -EINVAL;
}
break;