mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: BalaKrishna Mallipeddi <bkmallipeddi@yahoo.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Bad address problem while reading from hard disk(using sys_read).
Date: Fri, 20 Jun 2003 22:51:30 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.55.0306202248190.3449@bigblue.dev.mcafeelabs.com> (raw)
In-Reply-To: <20030621054000.66503.qmail@web10704.mail.yahoo.com>

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


      reply	other threads:[~2003-06-21  5:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-21  5:40 BalaKrishna Mallipeddi
2003-06-21  5:51 ` Davide Libenzi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.55.0306202248190.3449@bigblue.dev.mcafeelabs.com \
    --to=davidel@xmailserver.org \
    --cc=bkmallipeddi@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®