mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: dan carpenter <d_carpenter@sbcglobal.net>
To: Jens Axboe <axboe@suse.de>, "Paulo Andre'" <fscked@iol.pt>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Check copy_*_user return value in drivers/block/scsi_ioctl.c
Date: Sun, 25 May 2003 03:29:03 +0200	[thread overview]
Message-ID: <200305250329.04506.d_carpenter@sbcglobal.net> (raw)
In-Reply-To: <20030525162844.GJ812@suse.de>

On Sunday 25 May 2003 06:28 pm, Jens Axboe wrote:
> On Sun, May 25 2003, Paulo Andre' wrote:
> > Hi Jens,
> >
> > Please find attached a trivial patch that checks both
> > copy_to_user() and copy_from_user() returns values in scsi_ioctl.c,
> > returning accordinly in case of a transfer error.
>
> See above, we've already done access_ok() on the buffer so the
> "unchecked" copy_to/from_user are done that way on purpose. I suppose it
> could be made more explicit with __copy_to/from_user().

access_ok() doesn't seem to mean copy_to_user will return 0.

438 unsigned long copy_to_user(void *to, const void *from, unsigned long n)
439 {
440         prefetch(from);
441         if (access_ok(VERIFY_WRITE, to, n))
442                 n = __copy_to_user(to, from, n);
443         return n;
444 }

I have a script that finds all the unchecked calls to copy_to_user() and
I am curious about what cases it does not need to be checked.

http://kbugs.org/cgi-bin/index.py?page=bug_list&&script=UncheckedReturn&skernel=2.5.69&sfile=&start_bug=0&

Thanks,
dan carpenter



  reply	other threads:[~2003-05-25 18:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-25 16:25 Paulo Andre'
2003-05-25 16:28 ` Jens Axboe
2003-05-25  1:29   ` dan carpenter [this message]
2003-05-25 16:54   ` Oliver Neukum
2003-05-25 16:58   ` Paulo Andre'

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=200305250329.04506.d_carpenter@sbcglobal.net \
    --to=d_carpenter@sbcglobal.net \
    --cc=axboe@suse.de \
    --cc=fscked@iol.pt \
    --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®