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: <063D6719AE5E284EB5DD2968C1650D6D1CBAC9ED@AcuExch.aculab.com>
Date:	Mon, 5 Oct 2015 15:16:31 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Jiri Pirko' <jiri@...nulli.us>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	"sfeldma@...il.com" <sfeldma@...il.com>,
	"idosch@...lanox.com" <idosch@...lanox.com>,
	"eladr@...lanox.com" <eladr@...lanox.com>,
	"tgraf@...g.ch" <tgraf@...g.ch>,
	"ast@...mgrid.com" <ast@...mgrid.com>
Subject: RE: [patch net-next 10/14] rocker: pass "learning" value as a
 parameter to rocker_port_set_learning

From: Jiri Pirko
> Sent: 04 October 2015 22:26
> Be consistent with the rest of the setting functions, and pass
> "learning" as a bool function parameter.
...
> diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
> index fb7e8c2..d9329a7 100644
> --- a/drivers/net/ethernet/rocker/rocker_main.c
> +++ b/drivers/net/ethernet/rocker/rocker_main.c
> @@ -1634,6 +1634,7 @@ rocker_cmd_set_port_learning_prep(const struct rocker_port *rocker_port,
>  				  struct rocker_desc_info *desc_info,
>  				  void *priv)
>  {
> +	bool learning = *(int *)priv;
...
> static int rocker_port_set_learning(struct rocker_port *rocker_port,
> -				    struct switchdev_trans *trans)
> +				    struct switchdev_trans *trans,
> +				    bool learning)
> {
>  	return rocker_cmd_exec(rocker_port, trans, 0,
>  			       rocker_cmd_set_port_learning_prep,
> -			       NULL, NULL, NULL);
> +			       &learning, NULL, NULL);

This hit my 'casting between integer pointer types' bell.
It is clearly wrong if 'sizeof (bool) != sizeof (int)'.

It is much safer to only ever cast structure types to/from 'void *'.

	David

--
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