Merge "msm: mdss: validate the buffer size before allocating memory"

This commit is contained in:
Linux Build Service Account 2017-06-30 10:14:36 -07:00 committed by Gerrit - the friendly Code Review server
commit bf1349b227
1 changed files with 5 additions and 0 deletions

View File

@ -663,6 +663,11 @@ static ssize_t mdss_dsi_cmd_state_write(struct file *file,
int *link_state = file->private_data;
char *input;
if (!count) {
pr_err("%s: Zero bytes to be written\n", __func__);
return -EINVAL;
}
input = kmalloc(count, GFP_KERNEL);
if (!input) {
pr_err("%s: Failed to allocate memory\n", __func__);