summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-06-18 16:31:08 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-06-18 16:31:08 -0700
commitcfdc77c29d93be15eacf9636cdf6ba233d4aed86 (patch)
tree570261fb95a0a1853850cc29f0425b6735862951
parentf8d804ef051ca3e556089776f08a538616ea2e64 (diff)
parentfed910ca51f2ec49cdf3ba57c9e649b0d3dc21e5 (diff)
Merge "msm: mdss: validate the buffer size before allocating memory"
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c
index 48b151b8080a..82f6d4a123b5 100644
--- a/drivers/video/fbdev/msm/mdss_dsi.c
+++ b/drivers/video/fbdev/msm/mdss_dsi.c
@@ -773,6 +773,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__);