Merge "soc: qcom: dcc: avoid memory access violation"

This commit is contained in:
qctecmdr 2020-06-04 06:22:35 -07:00 • committed by Gerrit - the friendly Code Review server
commit 732a1ae2a0

View file

@ -1538,7 +1538,8 @@ static ssize_t dcc_sram_read(struct file *file, char __user *data,
if (drvdata->ram_size <= *ppos)
return 0;
if ((*ppos + len) > drvdata->ram_size)
if ((*ppos + len) < len
|| (*ppos + len) > drvdata->ram_size)
len = (drvdata->ram_size - *ppos);
buf = kzalloc(len, GFP_KERNEL);