Subject: Re: [Patch net-next] net_sched: move tp->root allocation into route4_init()

From: Sergei Shtylyov <[email-masked]>
Date: Thu, 05 Mar 2015 17:26:13 +0300

Hello.

On 3/5/2015 7:11 AM, Cong Wang wrote:

> Cc: Jamal Hadi Salim <[email-masked]>
> Signed-off-by: Cong Wang <[email-masked]>
> ---
>   net/sched/cls_route.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

> diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
> index 2ecd246..bb8a602 100644
> --- a/net/sched/cls_route.c
> +++ b/net/sched/cls_route.c
> @@ -258,6 +258,13 @@ static unsigned long route4_get(struct tcf_proto *tp, u32 handle)
>
>   static int route4_init(struct tcf_proto *tp)
>   {
> +	struct route4_head *head;
> +
> +	head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);

    Hm, checkpatch.pl should have suggested using sizeof(*head) instead...

> +	if (head == NULL)

    And using !head instead.

> +		return -ENOBUFS;
> +
> +	rcu_assign_pointer(tp->root, head);
>   	return 0;
>   }

WBR, Sergei