Subject: Re: linux-next: input tree build warnings

From: Tero Saarni <[email-masked]>
Date: Sat, 13 Jun 2009 00:54:50 +0300

On Fri, 2009-06-12 at 17:05 +1000, Stephen Rothwell wrote:
> Hi Dmitry,
> 
> Today's linux-next build (x86_64 allmodconfig) produced these warnings:
> 
> drivers/input/evdev.c: In function 'evdev_do_ioctl':
> drivers/input/evdev.c:632: warning: comparison of distinct pointer types lacks a cast
> drivers/input/evdev.c:660: warning: comparison of distinct pointer types lacks a cast
> 
> Introduced by commit 61c7bfcdf5acee06f58b246d6615989134719d19 ("Input:
> synaptics - add support for reporting x/y resolution").

My mistake, thanks for the heads up!

Input: fix warning: comparison of distinct pointer types

Signed-off-by: Tero Saarni <[email-masked]>
---
 drivers/input/evdev.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 7e46b96..7e8d218 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -628,8 +628,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
                                abs.flat = dev->absflat[t];
                                abs.resolution = dev->absres[t];
 
-                               if (copy_to_user(p, &abs,
-                                               min(_IOC_SIZE(cmd), sizeof(struct input_absinfo))))
+                               if (copy_to_user(p, &abs, min_t(size_t,
+                                                               _IOC_SIZE(cmd),
+                                                               sizeof(struct input_absinfo))))
                                        return -EFAULT;
 
                                return 0;
@@ -656,8 +657,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 
                                t = _IOC_NR(cmd) & ABS_MAX;
 
-                               if (copy_from_user(&abs, p,
-                                               min(_IOC_SIZE(cmd), sizeof(struct input_absinfo))))
+                               if (copy_from_user(&abs, p, min_t(size_t,
+                                                               _IOC_SIZE(cmd),
+                                                               sizeof(struct input_absinfo))))
                                        return -EFAULT;
 
                                /*
-- 
1.6.0.4