提交 7c806883 编写于 作者: Z ZhengShunQian 提交者: Greg Kroah-Hartman

nvmem: core: fix the out-of-range leak in read/write()

The position to read/write must be less than max
register size.
Signed-off-by: NZhengShunQian <zhengsq@rock-chips.com>
Acked-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 9ffecb10
......@@ -67,7 +67,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
int rc;
/* Stop the user from reading */
if (pos > nvmem->size)
if (pos >= nvmem->size)
return 0;
if (pos + count > nvmem->size)
......@@ -92,7 +92,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
int rc;
/* Stop the user from writing */
if (pos > nvmem->size)
if (pos >= nvmem->size)
return 0;
if (pos + count > nvmem->size)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册