* [B.A.T.M.A.N.] [PATCH] batman-adv: don't initialise batman_iv private members in hard-interface.c
@ 2013-04-02 10:16 Antonio Quartulli
2013-04-02 10:22 ` Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-04-02 10:16 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Antonio Quartulli
From: Antonio Quartulli <antonio@open-mesh.com>
hard-interface.c has to do not contain any routing algorithm
specific code.
Allocate the hard-interface with kzalloc() and remove any
useless and algorithm specific member initialisation
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
hard-interface.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/hard-interface.c b/hard-interface.c
index 18f4523..dc4ac29 100644
--- a/hard-interface.c
+++ b/hard-interface.c
@@ -577,7 +577,7 @@ batadv_hardif_add_interface(struct net_device *net_dev)
dev_hold(net_dev);
- hard_iface = kmalloc(sizeof(*hard_iface), GFP_ATOMIC);
+ hard_iface = kzalloc(sizeof(*hard_iface), GFP_ATOMIC);
if (!hard_iface)
goto release_dev;
@@ -603,12 +603,6 @@ batadv_hardif_add_interface(struct net_device *net_dev)
batadv_check_known_mac_addr(hard_iface->net_dev);
list_add_tail_rcu(&hard_iface->list, &batadv_hardif_list);
- /* This can't be called via a bat_priv callback because
- * we have no bat_priv yet.
- */
- atomic_set(&hard_iface->bat_iv.ogm_seqno, 1);
- hard_iface->bat_iv.ogm_buff = NULL;
-
return hard_iface;
free_if:
--
1.8.1.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't initialise batman_iv private members in hard-interface.c
2013-04-02 10:16 [B.A.T.M.A.N.] [PATCH] batman-adv: don't initialise batman_iv private members in hard-interface.c Antonio Quartulli
@ 2013-04-02 10:22 ` Antonio Quartulli
2013-04-15 9:27 ` Marek Lindner
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-04-02 10:22 UTC (permalink / raw)
To: b.a.t.m.a.n
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
On Tue, Apr 02, 2013 at 12:16:53PM +0200, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@open-mesh.com>
>
> hard-interface.c has to do not contain any routing algorithm
> specific code.
>
> Allocate the hard-interface with kzalloc() and remove any
> useless and algorithm specific member initialisation
>
> Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
> ---
For whoever is concerned about this missing initialisations, I have to say that
those are done in the routing specific API function upon hard-interface
activation. Meaning that the seqno and the ogm_buff are initialised somewhere
else before being used.
However, using kzalloc, ensure that all the members are initialised to 0 after
allocation.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: don't initialise batman_iv private members in hard-interface.c
2013-04-02 10:22 ` Antonio Quartulli
@ 2013-04-15 9:27 ` Marek Lindner
0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2013-04-15 9:27 UTC (permalink / raw)
To: b.a.t.m.a.n
On Tuesday, April 02, 2013 18:22:50 Antonio Quartulli wrote:
> On Tue, Apr 02, 2013 at 12:16:53PM +0200, Antonio Quartulli wrote:
> > From: Antonio Quartulli <antonio@open-mesh.com>
> >
> >
> >
> > hard-interface.c has to do not contain any routing algorithm
> > specific code.
> >
> >
> >
> > Allocate the hard-interface with kzalloc() and remove any
> > useless and algorithm specific member initialisation
> >
> >
> >
> > Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
> > ---
>
> For whoever is concerned about this missing initialisations, I have to say
> that those are done in the routing specific API function upon
> hard-interface activation. Meaning that the seqno and the ogm_buff are
> initialised somewhere else before being used.
>
> However, using kzalloc, ensure that all the members are initialised to 0
> after allocation.
Applied in revision 1cc6cbc.
Thanks,
Marek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-15 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 10:16 [B.A.T.M.A.N.] [PATCH] batman-adv: don't initialise batman_iv private members in hard-interface.c Antonio Quartulli
2013-04-02 10:22 ` Antonio Quartulli
2013-04-15 9:27 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox