All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Geliang Tang <geliangtang@gmail.com>
Cc: Mark Brown <broonie@kernel.org>, Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org
Subject: Applied "spi: spidev: use memdup_user" to the spi tree
Date: Mon, 15 May 2017 09:05:02 +0100	[thread overview]
Message-ID: <E1dAB02-0002iT-L8@finisterre> (raw)
In-Reply-To: <1028812604e64cd8e1ca2e25b119200fdbec2049.1493781496.git.geliangtang@gmail.com>

The patch

   spi: spidev: use memdup_user

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From f7929436a286ca31f0365a7013de968017f76818 Mon Sep 17 00:00:00 2001
From: Geliang Tang <geliangtang@gmail.com>
Date: Sat, 6 May 2017 23:42:17 +0800
Subject: [PATCH] spi: spidev: use memdup_user

Use memdup_user() helper instead of open-coding to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spidev.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 3b570018705c..d4d2d8d9f3e7 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -324,7 +324,6 @@ static struct spi_ioc_transfer *
 spidev_get_ioc_message(unsigned int cmd, struct spi_ioc_transfer __user *u_ioc,
 		unsigned *n_ioc)
 {
-	struct spi_ioc_transfer	*ioc;
 	u32	tmp;
 
 	/* Check type, command number and direction */
@@ -341,14 +340,7 @@ spidev_get_ioc_message(unsigned int cmd, struct spi_ioc_transfer __user *u_ioc,
 		return NULL;
 
 	/* copy into scratch area */
-	ioc = kmalloc(tmp, GFP_KERNEL);
-	if (!ioc)
-		return ERR_PTR(-ENOMEM);
-	if (__copy_from_user(ioc, u_ioc, tmp)) {
-		kfree(ioc);
-		return ERR_PTR(-EFAULT);
-	}
-	return ioc;
+	return memdup_user(u_ioc, tmp);
 }
 
 static long
-- 
2.11.0

  parent reply	other threads:[~2017-05-15  8:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06 15:42 [PATCH] agp: use memdup_user Geliang Tang
2017-05-06 15:42 ` [PATCH] net/hippi/rrunner: " Geliang Tang
2017-05-08 19:02   ` David Miller
2017-05-06 15:42 ` [PATCH] spi: spidev: " Geliang Tang
2017-05-06 15:42   ` Geliang Tang
2017-05-08  9:28   ` Geert Uytterhoeven
2017-05-08  9:28     ` Geert Uytterhoeven
2017-05-15  8:05   ` Mark Brown [this message]
2017-05-06 15:42 ` [PATCH] usb: cdc-wdm: " Geliang Tang
2017-05-06 17:40   ` Bjørn Mork
2017-05-08 15:14     ` [PATCH v2] " Geliang Tang
2017-05-09  7:50       ` Oliver Neukum
2017-05-06 15:42 ` [PATCH] wil6210: " Geliang Tang
2017-05-19  7:55   ` Kalle Valo
2017-05-06 15:42 ` [PATCH] wlcore: " Geliang Tang
2017-05-18 13:41   ` Kalle Valo
2017-05-06 15:42 ` [PATCH] xfrm: " Geliang Tang
2017-05-16  9:30   ` Steffen Klassert
2017-05-06 15:42 ` [PATCH] yam: " Geliang Tang
2017-05-08 19:02   ` David Miller

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=E1dAB02-0002iT-L8@finisterre \
    --to=broonie@kernel.org \
    --cc=geliangtang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.