aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/rc/ir-lirc-codec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 1e87ee8e5c99..f011c5d9dea1 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -100,7 +100,8 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
100 struct lirc_codec *lirc; 100 struct lirc_codec *lirc;
101 struct rc_dev *dev; 101 struct rc_dev *dev;
102 int *txbuf; /* buffer with values to transmit */ 102 int *txbuf; /* buffer with values to transmit */
103 int ret = 0, count; 103 int ret = 0;
104 size_t count;
104 105
105 lirc = lirc_get_pdata(file); 106 lirc = lirc_get_pdata(file);
106 if (!lirc) 107 if (!lirc)
@@ -110,7 +111,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
110 return -EINVAL; 111 return -EINVAL;
111 112
112 count = n / sizeof(int); 113 count = n / sizeof(int);
113 if (count > LIRCBUF_SIZE || count % 2 == 0) 114 if (count > LIRCBUF_SIZE || count % 2 == 0 || n % sizeof(int) != 0)
114 return -EINVAL; 115 return -EINVAL;
115 116
116 txbuf = memdup_user(buf, n); 117 txbuf = memdup_user(buf, n);