From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "Amit Choudhary" <amit2030@gmail.com>
Cc: "Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.6.19-rc2] net/ipv4/multipath_wrandom.c: check kmalloc() return value.
Date: Mon, 23 Oct 2006 09:41:20 +0300 [thread overview]
Message-ID: <84144f020610222341m2e4ad35fid82016ed431664b@mail.gmail.com> (raw)
In-Reply-To: <20061022232052.16b1bcf3.amit2030@gmail.com>
On 10/23/06, Amit Choudhary <amit2030@gmail.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@vger.kernel.org.
prev parent reply other threads:[~2006-10-23 6:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-23 6:20 Amit Choudhary
2006-10-23 6:41 ` Pekka Enberg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84144f020610222341m2e4ad35fid82016ed431664b@mail.gmail.com \
--to=penberg@cs.helsinki.fi \
--cc=amit2030@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®