From: Dan Carpenter <dan.carpenter@oracle.com>
To: Quentin Lambert <lambert.quentin@gmail.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>,
James Simmons <jsimmons@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space
Date: Mon, 5 Dec 2016 23:52:00 +0300 [thread overview]
Message-ID: <20161205205200.GB31243@mwanda> (raw)
In-Reply-To: <20161202173332.5100-1-lambert.quentin@gmail.com>
On Fri, Dec 02, 2016 at 06:33:32PM +0100, Quentin Lambert wrote:
> lnet_ipif_enumerate was assigning a pointer from kernel space to user
> space. This patch uses copy_to_user to properly do that assignment.
Put the exact warning message here.
>
> Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
> ---
> shouldn't we be using ifc_req instead of ifc_buf?
>
> drivers/staging/lustre/lnet/lnet/lib-socket.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
> +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
> @@ -181,7 +181,13 @@ lnet_ipif_enumerate(char ***namesp)
> goto out0;
> }
>
> - ifc.ifc_buf = (char *)ifr;
> + rc = copy_to_user(ifc.ifc_buf, (char *)ifr,
> + nalloc * sizeof(*ifr));
> + if (rc) {
> + rc = -ENOMEM;
> + goto out1;
> + }
No idea what's going on here. The original code is correct.
regards,
dan carpenter
next prev parent reply other threads:[~2016-12-05 20:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-02 17:33 [PATCH] staging: lustre: Fix a spatch warning due to an assignment from kernel to user space Quentin Lambert
2016-12-05 20:52 ` Dan Carpenter [this message]
2016-12-05 22:58 ` [lustre-devel] " Oleg Drokin
2016-12-06 13:48 ` Quentin Lambert
2016-12-07 15:20 ` Quentin Lambert
2016-12-07 15:32 ` Dan Carpenter
2016-12-07 15:33 ` Dan Carpenter
2016-12-07 15:42 ` Quentin Lambert
2016-12-07 19:22 ` Dan Carpenter
2016-12-07 19:52 ` James Simmons
2016-12-07 17:10 ` Oleg Drokin
2016-12-07 17:22 ` Oleg Drokin
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=20161205205200.GB31243@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jsimmons@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lambert.quentin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.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