Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to linux kernel 6.6.31 #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 03_read_write/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static ssize_t driver_read(struct file *File, char *user_buffer, size_t count, l
int to_copy, not_copied, delta;

/* Get amount of data to copy */
to_copy = min(count, buffer_pointer);
to_copy = umin(count, buffer_pointer);

/* Copy data to user */
not_copied = copy_to_user(user_buffer, buffer, to_copy);
Expand All @@ -46,7 +46,7 @@ static ssize_t driver_write(struct file *File, const char *user_buffer, size_t c
int to_copy, not_copied, delta;

/* Get amount of data to copy */
to_copy = min(count, sizeof(buffer));
to_copy = umin(count, sizeof(buffer));

/* Copy data to user */
not_copied = copy_from_user(buffer, user_buffer, to_copy);
Expand Down Expand Up @@ -97,7 +97,7 @@ static int __init ModuleInit(void) {
printk("read_write - Device Nr. Major: %d, Minor: %d was registered!\n", my_device_nr >> 20, my_device_nr & 0xfffff);

/* Create device class */
if((my_class = class_create(THIS_MODULE, DRIVER_CLASS)) == NULL) {
if((my_class = class_create(DRIVER_CLASS)) == NULL) {
printk("Device class can not be created!\n");
goto ClassError;
}
Expand Down