[media] rc-core: lirc use unsigned int
Durations can never be negative, so it makes sense to consistently use unsigned int for LIRC transmission. Contrary to the initial impression, this shouldn't actually change the userspace API. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
此提交包含在:
@@ -103,19 +103,19 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
|
||||
{
|
||||
struct lirc_codec *lirc;
|
||||
struct rc_dev *dev;
|
||||
int *txbuf; /* buffer with values to transmit */
|
||||
int ret = 0;
|
||||
unsigned int *txbuf; /* buffer with values to transmit */
|
||||
ssize_t ret = 0;
|
||||
size_t count;
|
||||
|
||||
lirc = lirc_get_pdata(file);
|
||||
if (!lirc)
|
||||
return -EFAULT;
|
||||
|
||||
if (n % sizeof(int))
|
||||
if (n < sizeof(unsigned) || n % sizeof(unsigned))
|
||||
return -EINVAL;
|
||||
|
||||
count = n / sizeof(int);
|
||||
if (count > LIRCBUF_SIZE || count % 2 == 0 || n % sizeof(int) != 0)
|
||||
count = n / sizeof(unsigned);
|
||||
if (count > LIRCBUF_SIZE || count % 2 == 0)
|
||||
return -EINVAL;
|
||||
|
||||
txbuf = memdup_user(buf, n);
|
||||
@@ -129,7 +129,10 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
|
||||
}
|
||||
|
||||
if (dev->tx_ir)
|
||||
ret = dev->tx_ir(dev, txbuf, (u32)n);
|
||||
ret = dev->tx_ir(dev, txbuf, count);
|
||||
|
||||
if (ret > 0)
|
||||
ret *= sizeof(unsigned);
|
||||
|
||||
out:
|
||||
kfree(txbuf);
|
||||
|
新增問題並參考
封鎖使用者