[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <84144f020610222341m2e4ad35fid82016ed431664b@mail.gmail.com>
Date: Mon, 23 Oct 2006 09:41:20 +0300
From: "Pekka Enberg" <penberg@...helsinki.fi>
To: "Amit Choudhary" <amit2030@...il.com>
Cc: "Linux Kernel" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2.6.19-rc2] net/ipv4/multipath_wrandom.c: check kmalloc() return value.
On 10/23/06, Amit Choudhary <amit2030@...il.com> wrote:
> diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c
> index 92b0482..45bfd20 100644
> --- a/net/ipv4/multipath_wrandom.c
> +++ b/net/ipv4/multipath_wrandom.c
> @@ -242,6 +242,11 @@ static void wrandom_set_nhinfo(__be32 ne
> target_route = (struct multipath_route *)
> kmalloc(size_rt, GFP_ATOMIC);
>
> + if (!target_route) {
> + spin_unlock_bh(&state[state_idx].lock);
> + return;
> + }
> +
> target_route->gw = nh->nh_gw;
> target_route->oif = nh->nh_oif;
> memset(&target_route->rcu, 0, sizeof(struct rcu_head));
> @@ -263,6 +268,11 @@ static void wrandom_set_nhinfo(__be32 ne
> target_dest = (struct multipath_dest*)
> kmalloc(size_dst, GFP_ATOMIC);
>
> + if (!target_dest) {
> + spin_unlock_bh(&state[state_idx].lock);
> + return;
> + }
> +
You probably want to use goto here so you don't need to duplicate
spin_unlock_bh(). Otherwise looks good. Send this to akpm and cc
netdev@...r.kernel.org.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists