Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit daaba4fa authored by YOSHIFUJI Hideaki / 吉藤英明's avatar YOSHIFUJI Hideaki / 吉藤英明 Committed by David S. Miller
Browse files

net neighbour, decnet: Ensure to align device private data on preferred alignment.



To allow both of protocol-specific data and device-specific data
attached with neighbour entry, and to eliminate size calculation
cost when allocating entry, sizeof protocol-speicic data must be
multiple of NEIGH_PRIV_ALIGN.  On 64bit archs,
sizeof(struct dn_neigh) is multiple of NEIGH_PRIV_ALIGN, but on
32bit archs, it was not.

Introduce NEIGH_ENTRY_SPACE() macro to ensure that protocol-specific
entry-size meets our requirement.

Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ec16ef22
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ struct neigh_table {
};

#define NEIGH_PRIV_ALIGN	sizeof(long long)
#define NEIGH_ENTRY_SIZE(size)	ALIGN((size), NEIGH_PRIV_ALIGN)

static inline void *neighbour_priv(const struct neighbour *n)
{
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ static u32 dn_neigh_hash(const void *pkey,

struct neigh_table dn_neigh_table = {
	.family =			PF_DECnet,
	.entry_size =			sizeof(struct dn_neigh),
	.entry_size =			NEIGH_ENTRY_SIZE(sizeof(struct dn_neigh)),
	.key_len =			sizeof(__le16),
	.hash =				dn_neigh_hash,
	.constructor =			dn_neigh_construct,