Re: [PATCH] staging: vt6655: preserve address space by not casting

From: Dan Carpenter
Date: Mon Jun 16 2014 - 03:56:16 EST


On Fri, Jun 13, 2014 at 12:11:51PM +0200, Martin Kepplinger wrote:
> Fix the sparse error: cast removes address space of expression.
> ---
> Is that even correct?

It's correct but not complete.

vt6655 impliment their own versions of ethtool_ioctl() when they should
be using the standard versions.

The vt6655 version of ethtool_ioctl() should be annotated so it's marked
that the second parameter is marked as a __user pointer. It doesn't
print a Sparse warning because at a certain point Sparse just says:
"warning: too many warnings" and gives up.

> I haven't signed-off on it yet.
> ethtool_ioctl() takes a (void *) as user data, dereferenced and assigend to u32.
> applies to next-20140611

It doesn't dereference the pointer. You are getting mixed up with the
vt6656 version of ethtool_ioctl() I think? You're not allowed to
dereference __user pointers.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/