lkmpg
lkmpg copied to clipboard
vinput: Fix multiple issue
Fix multiple issues for vinput module:
- Removes redundant memset calls that were unnecessary since memory allocated with kzalloc is already zeroed due to the __GFP_ZERO gfp flag.
- Fixes a NULL pointer dereference caused by failed kzalloc allocation. It adds a check for the return value of kzalloc and handles failed allocations by printing an error message and returning ERR_PTR(-ENOMEM).
- Corrects the handling of failures in raw_copy_to_user() in vinput_read(). Previously, the function would modify '*offset' incorrectly on raw_copy_to_user() failure. Fix this behavior by changing count = -EFAULT to return -EFAULT instead.
Can you check #52 ?
Looks good to me.
Can you check #52 ?
I can spend some time understanding try_module_get and put_module_get and try to resolve this issue.
Thank @visitorckw for contributing!