unsigned long ipc_count = 0;
        struct dentry *dentry;
        int err;
-       size_t size;
        char *string;
        int ret;
 
+       if (*ppos != 0)
+               return -EINVAL;
+
        string = kzalloc(count + 1, GFP_KERNEL);
        if (!string)
                return -ENOMEM;
 
-       size = simple_write_to_buffer(string, count, ppos, buffer, count);
+       if (copy_from_user(string, buffer, count)) {
+               ret = -EFAULT;
+               goto out;
+       }
 
        /*
         * write op is only supported for ipc_flood_count or
        /* limit max duration/ipc count for flood test */
        if (flood_duration_test) {
                if (!ipc_duration_ms) {
-                       ret = size;
+                       ret = count;
                        goto out;
                }
 
                        ipc_duration_ms = MAX_IPC_FLOOD_DURATION_MS;
        } else {
                if (!ipc_count) {
-                       ret = size;
+                       ret = count;
                        goto out;
                }
 
        if (err < 0)
                dev_err_ratelimited(dev, "debugfs write failed to idle %d\n", err);
 
-       /* return size if test is successful */
+       /* return count if test is successful */
        if (ret >= 0)
-               ret = size;
+               ret = count;
 out:
        kfree(string);
        return ret;