Merge "disp: msm: sde: add check before buffer copy"

This commit is contained in:
qctecmdr 2019-07-26 02:56:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit 51e3c33c7d
2 changed files with 3 additions and 0 deletions

View file

@ -1698,6 +1698,7 @@ static ssize_t _sde_debugfs_conn_cmd_tx_sts_read(struct file *file,
return 0;
}
blen = min_t(size_t, MAX_CMD_PAYLOAD_SIZE, count);
if (copy_to_user(buf, buffer, blen)) {
SDE_ERROR("copy to user buffer failed\n");
return -EFAULT;

View file

@ -1102,6 +1102,7 @@ end:
if (blen <= 0)
return 0;
blen = min_t(size_t, MAX_BUFFER_SIZE, count);
if (copy_to_user(buf, buffer, blen))
return -EFAULT;
@ -1195,6 +1196,7 @@ end:
if (blen <= 0)
return 0;
blen = min_t(size_t, MAX_BUFFER_SIZE, count);
if (copy_to_user(buf, buffer, blen))
return -EFAULT;