drm/msm/dsi-staging: Add range check in debugfs_dump_info_read
Add a check to make sure that the length of bytes copied to the destination buffer doesn't exceed the requested buffer length before calling the copy_to_user to avoid buffer overflow. Change-Id: Icd65b9be2791a8a487dfc8d7461aadce61de3f1b Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
This commit is contained in:
parent
d598338175
commit
9e11c9b247
1 changed files with 4 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -98,6 +98,9 @@ static ssize_t debugfs_dump_info_read(struct file *file,
|
|||
"\tClock master = %s\n",
|
||||
display->ctrl[display->clk_master_idx].ctrl->name);
|
||||
|
||||
if (len > count)
|
||||
len = count;
|
||||
|
||||
if (copy_to_user(buff, buf, len)) {
|
||||
kfree(buf);
|
||||
return -EFAULT;
|
||||
|
|
Loading…
Add table
Reference in a new issue