lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1338825881.3979.203.camel@deadeye>
Date:	Mon, 4 Jun 2012 17:04:41 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Joe Perches <joe@...ches.com>
CC:	"David S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [PATCH] net: Remove casts to same type

On Sun, 2012-06-03 at 20:41 -0700, Joe Perches wrote:
> Adding casts of objects to the same type is unnecessary
> and confusing for a human reader.
> 
> For example, this cast:
> 
> 	int y;
> 	int *p = (int *)&y;
> 
> I used the coccinelle script below to find and remove these
> unnecessary casts.  I manually removed the conversions this
> script produces of casts with __force and __user.
[...]
> diff --git a/net/9p/client.c b/net/9p/client.c
> index a170893..5cbea90 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -1548,7 +1548,7 @@ p9_client_read(struct p9_fid *fid, char *data, char __user *udata, u64 offset,
>  			kernel_buf = 1;
>  			indata = data;
>  		} else
> -			indata = (char *)udata;
> +			indata = udata;
>  		/*
>  		 * response header len is 11
>  		 * PDU Header(7) + IO Size (4)
[...]

This one is casting char __user * to char *.  We need a cast to let
sparse know this is deliberate, though presumably we need __force as
well.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ