* [PATCH net-next] net neighbour,decnet: Ensure to align device private data on preferred alignment.
@ 2013-02-09 17:00 YOSHIFUJI Hideaki
2013-02-11 5:23 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-02-09 17:00 UTC (permalink / raw)
To: David Miller; +Cc: fengguang.wu, netdev, linux-kernel, YOSHIFUJI Hideaki
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: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
include/net/neighbour.h | 1 +
net/decnet/dn_neigh.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 629ee57..7e748ad 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -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)
{
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 3aede1b..856636a 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -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,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net neighbour,decnet: Ensure to align device private data on preferred alignment.
2013-02-09 17:00 [PATCH net-next] net neighbour,decnet: Ensure to align device private data on preferred alignment YOSHIFUJI Hideaki
@ 2013-02-11 5:23 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-02-11 5:23 UTC (permalink / raw)
To: yoshfuji; +Cc: fengguang.wu, netdev, linux-kernel
From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Date: Sun, 10 Feb 2013 02:00:59 +0900
> 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: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-11 5:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-09 17:00 [PATCH net-next] net neighbour,decnet: Ensure to align device private data on preferred alignment YOSHIFUJI Hideaki
2013-02-11 5:23 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).