Bad address problem while reading from hard disk(using sys_read).

Bad address problem while reading from hard disk(using sys_read).

Post by Davide Libenz » Sun, 22 Jun 2003 08:00:11




> Hi,
>     I developed a kernel module. Within that i am
> dynamically allocating memory(using kmalloc and
> vmalloc) for a buffer to read data. After that while
> trying to read into this buffer from the hard disk
> using sys_read i am getting an error. And the same
> error i am getting while writing into another buffer,
> which was allocated in the same way, using sys_write.
> The error number set is -14(EFAULT) i.e., Bad address.

>    Give me any idea to resolve the problem.

>   If anyone help me i am gretful to them.

All sys_* functions expect user space addresses and you passing a kernel
space one. You need something like :

        mm_segment_t oldfs;

        oldfs = get_fs();
        set_fs(KERNEL_DS);
        nread = sys_read(fd, buf, cnt);
        set_fs(oldfs);

(If you really want to do that)

- Davide

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. How to lock the bad sectors on the hard disk without reformatting the hard disk !!??

Hello, dear Internet friends !!

Anyone can tell me if there is any utility to lock the bad sectors for
the ext2fs under Linux without re-initiating the harddisk.

I used "fsck /dev/hdaX" to fix the filesystem but it could not lock
the physical bad-sectors. When I wrote something to hit the bad
sector, my Linux Panic could get Kernel Panic due to accessing
some bad sectors. "fsck" or "exfsck" cannot fix them and it can
only recover the damaged file system only (NOT the bad sectors).
Can you tell me how to do ?

Thanks for your creat help !!!

Best Regards. Louie

2. Limiting users

3. I need to read directly from hard disk device (really need to read /var partition)

4. ksh != sh on traps

5. Bad disk IO performance problem during reads and writes

6. Fast Ethernet ?

7. Replacing Hard Disk - Copying Linux system to new Hard Disk ????

8. SCSI overruns/underruns - but only sometimes

9. hard disk problem: CANNOT READ: BLK

10. (Pleas Read) Problems partitioning hard disk...

11. Ultra 5 IDE hard disks - can I use any PC hard disk?

12. can we copy an installed Linux on a hard disk onto another hard disk

13. snoop: network read failed: Bad address