c
// ... other code ...

// Enforce a maximum size limit (adjust as needed)
#define MAX_ALLOWED_SIZE (4096) 

if (lbuf > MAX_ALLOWED_SIZE) {
    // Handle the error appropriately (log, return error code)
    return -EINVAL; 
}

buffer = vmemdup_user(buf, lbuf);

// ... rest of the code ...
