From: Christoph Hellwig <hch@infradead.org>
To: Jesper Juhl <juhl-lkml@dif.dk>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Markus Lidel <markus.lidel@shadowconnect.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] add missing checks of __copy_to_user return value in i2o_config.c
Date: Wed, 6 Oct 2004 11:41:54 +0100 [thread overview]
Message-ID: <20041006114154.A29243@infradead.org> (raw)
In-Reply-To: <Pine.LNX.4.61.0410052317350.2913@dragon.hygekrogen.localhost>; from juhl-lkml@dif.dk on Tue, Oct 05, 2004 at 11:43:54PM +0200
On Tue, Oct 05, 2004 at 11:43:54PM +0200, Jesper Juhl wrote:
>
> This patch fixes up the following :
>
> CC drivers/message/i2o/i2o_config.o
> include/asm/uaccess.h: In function `i2o_cfg_getiops':
> drivers/message/i2o/i2o_config.c:190: warning: ignoring return value of `__copy_to_user', declared with attribute warn_unused_result
> include/asm/uaccess.h: In function `i2o_cfg_swul':
> drivers/message/i2o/i2o_config.c:477: warning: ignoring return value of `__copy_to_user', declared with attribute warn_unused_result
>
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
>
> diff -up linux-2.6.9-rc3-bk5-orig/drivers/message/i2o/i2o_config.c linux-2.6.9-rc3-bk5/drivers/message/i2o/i2o_config.c
> --- linux-2.6.9-rc3-bk5-orig/drivers/message/i2o/i2o_config.c 2004-09-30 05:05:40.000000000 +0200
> +++ linux-2.6.9-rc3-bk5/drivers/message/i2o/i2o_config.c 2004-10-05 23:32:43.000000000 +0200
> @@ -187,7 +187,8 @@ static int i2o_cfg_getiops(unsigned long
> list_for_each_entry(c, &i2o_controllers, list)
> tmp[c->unit] = 1;
>
> - __copy_to_user(user_iop_table, tmp, MAX_I2O_CONTROLLERS);
> + if (__copy_to_user(user_iop_table, tmp, MAX_I2O_CONTROLLERS))
> + return -EFAULT;
should be copy_to_user (with return value checked) and the
access_ok above should be removed.
> return 0;
> };
> @@ -474,7 +475,9 @@ static int i2o_cfg_swul(unsigned long ar
> return status;
> }
>
> - __copy_to_user(kxfer.buf, buffer.virt, fragsize);
> + if (__copy_to_user(kxfer.buf, buffer.virt, fragsize))
> + return -EFAULT;
> +
> i2o_dma_free(&c->pdev->dev, &buffer);
you're adding a leak here,and again please use copy_to_user and remove
the access_ok abov
next prev parent reply other threads:[~2004-10-06 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-05 21:43 [PATCH] add missing checks of __copy_to_user return value in i2o_config.c Jesper Juhl
2004-10-05 22:21 ` Andrew Morton
2004-10-05 22:34 ` Jesper Juhl
2004-10-05 22:43 ` Andrew Morton
2004-10-05 23:11 ` Jesper Juhl
2004-10-06 10:41 ` Christoph Hellwig [this message]
2004-10-06 20:11 ` Jesper Juhl
2004-10-07 21:01 ` Markus Lidel
2004-10-08 0:23 ` Jesper Juhl
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=20041006114154.A29243@infradead.org \
--to=hch@infradead.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=juhl-lkml@dif.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.lidel@shadowconnect.com \
/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