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:	Tue, 8 Jan 2013 15:43:19 +0100
From:	Laurent Navet <laurent.navet@...il.com>
To:	w.sang@...gutronix.de
Cc:	ben-linux@...ff.org, khali@...ux-fr.org, linux-i2c@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Laurent Navet <laurent.navet@...il.com>
Subject: Re: [PATCH] drivers: i2c: muxes: fix sizeof(ptr)

This is not really a bug as mux->busses is a multilevel pointer, so
the result of sizeof(ptr) is the same as sizeof(*ptr).
But I think this is more logical and according to CodingStyle rules like this.
This is also what is done for mux->states a few lines above.

Regards,


2013/1/8, Laurent Navet <laurent.navet@...il.com>:
> sizeof when applied to a pointer typed expression gives the size of
> the pointer
>
> The semantic patch that makes this output is available
> in scripts/coccinelle/misc/noderef.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Laurent Navet <laurent.navet@...il.com>
> ---
>  drivers/i2c/muxes/i2c-mux-pinctrl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c
> b/drivers/i2c/muxes/i2c-mux-pinctrl.c
> index 7fa5b24..f958d0f 100644
> --- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
> +++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
> @@ -167,7 +167,7 @@ static int __devinit i2c_mux_pinctrl_probe(struct
> platform_device *pdev)
>  	}
>
>  	mux->busses = devm_kzalloc(&pdev->dev,
> -				   sizeof(mux->busses) * mux->pdata->bus_count,
> +				   sizeof(*mux->busses) * mux->pdata->bus_count,
>  				   GFP_KERNEL);
>  	if (!mux->busses) {
>  		dev_err(&pdev->dev, "Cannot allocate busses\n");
> --
> 1.7.10.4
>
>


-- 
« On ne résout pas un problème avec les modes de pensée qui l’ont engendré. »
« You cannot solve current problems with current thinking. Current
problems are the result of current thinking »
--
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