[PATCH 3/3] fbdev/sbuslib: avoid compat_alloc_user_space in fbiogetputcmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rewrite fbiogetputcmap to call the low-level sbusfb_ioctl_{put,get}cmap
helpers directly and thus avoid usage of the deprecated
compat_alloc_user_space API.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 drivers/video/fbdev/sbuslib.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/video/fbdev/sbuslib.c b/drivers/video/fbdev/sbuslib.c
index 1c3bf1cb8dccd7..ef74e3e6326a06 100644
--- a/drivers/video/fbdev/sbuslib.c
+++ b/drivers/video/fbdev/sbuslib.c
@@ -188,23 +188,23 @@ EXPORT_SYMBOL(sbusfb_ioctl_helper);
 static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long arg)
 {
 	struct fbcmap32 __user *argp = (void __user *)arg;
-	struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p));
+	struct fbcmap kc;
 	u32 addr;
 	int ret;
 
-	ret = copy_in_user(p, argp, 2 * sizeof(int));
+	ret = get_user(kc.index, &argp->index);
+	ret |= get_user(kc.count, &argp->count);
 	ret |= get_user(addr, &argp->red);
-	ret |= put_user(compat_ptr(addr), &p->red);
+	kc.red = compat_ptr(addr);
 	ret |= get_user(addr, &argp->green);
-	ret |= put_user(compat_ptr(addr), &p->green);
+	kc.green = compat_ptr(addr);
 	ret |= get_user(addr, &argp->blue);
-	ret |= put_user(compat_ptr(addr), &p->blue);
+	kc.blue = compat_ptr(addr);
 	if (ret)
 		return -EFAULT;
-	return info->fbops->fb_ioctl(info,
-			(cmd == FBIOPUTCMAP32) ?
-			FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC,
-			(unsigned long)p);
+	if (cmd == FBIOPUTCMAP32)
+		return sbusfb_ioctl_putcmap(&kc, info);
+	return sbusfb_ioctl_getcmap(&kc, info);
 }
 
 int sbusfb_compat_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
-- 
2.28.0




[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux