mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Bad address problem while reading from hard disk(using sys_read).
@ 2003-06-21  5:40 BalaKrishna Mallipeddi
  2003-06-21  5:51 ` Davide Libenzi
  0 siblings, 1 reply; 2+ messages in thread
From: BalaKrishna Mallipeddi @ 2003-06-21  5:40 UTC (permalink / raw)
  To: linux-kernel

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.

Thanks & Regards


=====
BalaKrishna Mallipeddi
Member Technical Staff Software
Innomedia Technologies Pvt. Ltd.,
#3278, 12th Main, HAL 2nd stage,
Bangalore-560008,
INDIA
Phone : 5278389 + 123

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bad address problem while reading from hard disk(using sys_read).
  2003-06-21  5:40 Bad address problem while reading from hard disk(using sys_read) BalaKrishna Mallipeddi
@ 2003-06-21  5:51 ` Davide Libenzi
  0 siblings, 0 replies; 2+ messages in thread
From: Davide Libenzi @ 2003-06-21  5:51 UTC (permalink / raw)
  To: BalaKrishna Mallipeddi; +Cc: Linux Kernel Mailing List

On Fri, 20 Jun 2003, BalaKrishna Mallipeddi wrote:

> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-21  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-21  5:40 Bad address problem while reading from hard disk(using sys_read) BalaKrishna Mallipeddi
2003-06-21  5:51 ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®