import PULS_20180308
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / thermal / mt8127 / mtk_ts_wmt.c
index 857c31e1c6914cade895b962011b34de04e71d26..a2833aa122ba221f628f9fe5e52b218aa0bee546 100644 (file)
@@ -969,6 +969,7 @@ ssize_t wmt_tm_wfd_write(struct file *filp, const char __user *buf, size_t len,
        int ret = 0;
        char tmp[MAX_LEN] = {0};
 
+       len = (len < (MAX_LEN-1)) ? len : (MAX_LEN-1);
        /* write data to the buffer */
        if (copy_from_user(tmp, buf, len)) {
                return -EFAULT;
@@ -1011,6 +1012,7 @@ ssize_t wmt_tm_pid_write(struct file *filp, const char __user *buf, size_t len,
        int ret = 0;
        char tmp[MAX_LEN] = {0};
 
+       len = (len < (MAX_LEN-1)) ? len : (MAX_LEN-1);
        /* write data to the buffer */
        if ( copy_from_user(tmp, buf, len) ) {
                return -EFAULT;