* [PATCH] IR/lirc: use memdup_user instead of copy_from_user
@ 2010-07-16 21:29 Jarod Wilson
0 siblings, 0 replies; only message in thread
From: Jarod Wilson @ 2010-07-16 21:29 UTC (permalink / raw)
To: linux-media
Inspired by 64047b94ede76e0c72ba8af98505e96d6a664519
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
drivers/media/IR/ir-lirc-codec.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c
index afb1ada..ee1f2d4 100644
--- a/drivers/media/IR/ir-lirc-codec.c
+++ b/drivers/media/IR/ir-lirc-codec.c
@@ -74,14 +74,9 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
if (count > LIRCBUF_SIZE || count % 2 == 0)
return -EINVAL;
- txbuf = kzalloc(sizeof(int) * LIRCBUF_SIZE, GFP_KERNEL);
- if (!txbuf)
- return -ENOMEM;
-
- if (copy_from_user(txbuf, buf, n)) {
- ret = -EFAULT;
- goto out;
- }
+ txbuf = memdup_user(buf, n);
+ if (IS_ERR(txbuf))
+ return PTR_ERR(txbuf);
ir_dev = lirc->ir_dev;
if (!ir_dev) {
--
1.7.1.1
--
Jarod Wilson
jarod@redhat.com
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-16 21:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-16 21:29 [PATCH] IR/lirc: use memdup_user instead of copy_from_user Jarod Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox