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]
Date:	Wed, 16 Oct 2013 18:40:16 +0200
From:	Takashi Iwai <tiwai@...e.de>
To:	"Geyslan G. Bem" <geyslan@...il.com>
Cc:	kernel-br@...glegroups.com, Jaroslav Kysela <perex@...ex.cz>,
	Bill Pemberton <wfp5p@...ginia.edu>,
	alsa-devel@...a-project.org (moderated list:SOUND),
	linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH] sound: pci: emu10k1: Remove useless casting in emufx.c

At Wed, 16 Oct 2013 13:21:45 -0300,
Geyslan G. Bem wrote:
> 
> Casting (void *) value returned by kcalloc is useless
> as mentioned in Documentation/CodingStyle, Chap 14.
> 
> Signed-off-by: Geyslan G. Bem <geyslan@...il.com>

You missed __user prefix.  You can't cast user and kernel pointers
implicitly.


Takashi

> ---
>  sound/pci/emu10k1/emufx.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
> index 0275209..3f51dac 100644
> --- a/sound/pci/emu10k1/emufx.c
> +++ b/sound/pci/emu10k1/emufx.c
> @@ -1183,9 +1183,8 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
>  	mm_segment_t seg;
>  
>  	if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL ||
> -	    (icode->gpr_map = (u_int32_t __user *)
> -	     kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t),
> -		     GFP_KERNEL)) == NULL ||
> +	    (icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t),
> +				      GFP_KERNEL)) == NULL ||
>  	    (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
>  				sizeof(*controls), GFP_KERNEL)) == NULL) {
>  		err = -ENOMEM;
> @@ -1815,10 +1814,9 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
>  
>  	if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL)
>  		return -ENOMEM;
> -	if ((icode->gpr_map = (u_int32_t __user *)
> -	     kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t),
> -		     GFP_KERNEL)) == NULL ||
> -            (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
> +	if ((icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t),
> +				      GFP_KERNEL)) == NULL ||
> +	    (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
>  				sizeof(struct snd_emu10k1_fx8010_control_gpr),
>  				GFP_KERNEL)) == NULL ||
>  	    (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) {
> -- 
> 1.8.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ