diff --git a/eg_03_scull_basic/fops.c b/eg_03_scull_basic/fops.c index 7832265..56a0f4a 100644 --- a/eg_03_scull_basic/fops.c +++ b/eg_03_scull_basic/fops.c @@ -69,8 +69,8 @@ ssize_t scull_read(struct file *filp, char __user *buff, size_t count, goto end_of_file; } - if (count > pblock->offset) - count = pblock->offset; + if (count > pblock->offset - toffset) + count = pblock->offset - toffset; if (copy_to_user(buff, pblock->data, count)) { retval = -EFAULT; diff --git a/eg_04_proc_fs_basic/main.c b/eg_04_proc_fs_basic/main.c index 536305e..e1f1f84 100644 --- a/eg_04_proc_fs_basic/main.c +++ b/eg_04_proc_fs_basic/main.c @@ -70,8 +70,7 @@ void __exit m_exit(void) { printk(KERN_WARNING MODULE_NAME " unloaded\n"); - remove_proc_entry(PROC_FS_NAME, parent); - remove_proc_entry(SUB_DIR_NAME, NULL); + remove_proc_subtree(SUB_DIR_NAME, NULL); } module_init(m_init);