Why __force sparse annotation needed in copy_from_user() to vmalloc'ed area
Hello, In the course of reviewing a new framebuffer driver [1], I discovered the following bit of code: + dst = (void __force *) (info->screen_base + p); + + if (copy_from_user(dst, buf, count)) + err = -EFAULT; Where info->screen_base is a vmalloc'ed memory area. Many other framebuffer drivers have used this __force sparse annotation: see [2] or [3] for example. I am confused as to why sparse requires the __force annotation for what seems to be a regular user to kernel copy. The __force annotation is typically not needed for user to kernel copy when the destination kernel buffer has been kmalloc'ed. Why does sparse handles vmalloc'ed buffer differently, and gives a warning in this case? Thanks, Thomas [1] http://marc.info/?l=linux-fbdev&m=134683775709128&w=2 [2] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdif... [3] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdif... -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
participants (1)
-
Thomas Petazzoni