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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <wihh8fqvq3q.fsf@dev-r-vrt-156.mtr.labs.mlnx>
Date:   Thu, 6 Dec 2018 11:42:44 +0000
From:   Petr Machata <petrm@...lanox.com>
To:     David Miller <davem@...emloft.net>
CC:     Ido Schimmel <idosch@...lanox.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bridge@...ts.linux-foundation.org" 
        <bridge@...ts.linux-foundation.org>,
        Jiri Pirko <jiri@...lanox.com>,
        "roopa@...ulusnetworks.com" <roopa@...ulusnetworks.com>,
        "nikolay@...ulusnetworks.com" <nikolay@...ulusnetworks.com>,
        mlxsw <mlxsw@...lanox.com>
Subject: Re: [PATCH net-next 01/12] vxlan: Add a function to init
 switchdev_notifier_vxlan_fdb_info

David Miller <davem@...emloft.net> writes:

> From: Ido Schimmel <idosch@...lanox.com>
> Date: Wed, 5 Dec 2018 15:50:23 +0000
>
>> +static struct switchdev_notifier_vxlan_fdb_info
>> +vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan,
>> +				  const struct vxlan_fdb *fdb,
>> +				  const struct vxlan_rdst *rd)
>> +{
>> +	struct switchdev_notifier_vxlan_fdb_info fdb_info = {
>> +		.info.dev = vxlan->dev,
>> +		.remote_ip = rd->remote_ip,
>> +		.remote_port = rd->remote_port,
>> +		.remote_vni = rd->remote_vni,
>> +		.remote_ifindex = rd->remote_ifindex,
>> +		.vni = fdb->vni,
>> +		.offloaded = rd->offloaded,
>> +		.added_by_user = fdb->flags & NTF_VXLAN_ADDED_BY_USER,
>> +	};
>> +
>> +	memcpy(fdb_info.eth_addr, fdb->eth_addr, ETH_ALEN);
>> +	return fdb_info;
>> +}
>
> Never return a structure by value from a function.  Do you have any idea
> how the compiler implement this?
>
> In the one call site in vxlan.c after this patch is applied, _two_
> switchdev_notifier_cxlan_fdb_info objects are allocated on the stack.
>
> vxlan_fdb_swtich_dev_notifier_info() fills in the first one, and
> then the caller copies that into the second one.
>
> A huge waste.
>
> Please just pass "&info" as an argument.

OK

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ