lkml.org 
[lkml]   [2014]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: lirc: Fix sparse warnings
On Thu, May 08, 2014 at 01:11:48PM +0300, Tuomas Tynkkynen wrote:
> Fix sparse warnings by adding __user and __iomem annotations where
> necessary and removing certain unnecessary casts.
>
> Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>

This patch adds spaces between the cast and the variable. There
shouldn't be a cast. That rule is so people remember that casting is a
high precedence operation.

Joe recently added a check for cast spacing to ./scripts/checkpatch.pl
--strict. Run your patch through ./scripts/checkpatch.pl --strict and
fix the warnings.

> @@ -470,36 +471,36 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
>
> switch (cmd) {
> case LIRC_GET_FEATURES:
> - result = put_user(features, (__u32 *) arg);
> + result = put_user(features, (__u32 __user *) arg);

arg is alway a u32 __user pointer. Do this at the start of the
function.

u32 __user *uptr = (u32 __user *)arg;

Then replace all the "arg" references with "uptr". Btw, the difference
between __u32 and u32 is that __u32 is for code which is shared with
user space and u32 is only allowed in kernel code.

regards,
dan carpenter



\
 
 \ /
  Last update: 2014-05-08 13:21    [W:0.089 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site