From: "Jiang, Dave" <dave.jiang@intel.com>
To: "Allen.Hubbe@emc.com" <Allen.Hubbe@emc.com>,
"sudipm.mukherjee@gmail.com" <sudipm.mukherjee@gmail.com>,
"jdmason@kudzu.us" <jdmason@kudzu.us>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-ntb@googlegroups.com" <linux-ntb@googlegroups.com>
Subject: Re: [PATCH] ntb: fix possible NULL dereference
Date: Thu, 10 Mar 2016 16:24:28 +0000 [thread overview]
Message-ID: <1457627059.3577.34.camel@intel.com> (raw)
In-Reply-To: <1457612471-26128-1-git-send-email-sudipm.mukherjee@gmail.com>
On Thu, 2016-03-10 at 17:51 +0530, Sudip Mukherjee wrote:
> kmalloc can fail and we should check for NULL before using the
> pointer
> returned by kmalloc.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Thanks!
> ---
> drivers/ntb/test/ntb_perf.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/ntb/test/ntb_perf.c
> b/drivers/ntb/test/ntb_perf.c
> index c8a37ba..b21e647 100644
> --- a/drivers/ntb/test/ntb_perf.c
> +++ b/drivers/ntb/test/ntb_perf.c
> @@ -541,6 +541,8 @@ static ssize_t debugfs_run_read(struct file
> *filp, char __user *ubuf,
> return 0;
>
> buf = kmalloc(64, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> out_offset = snprintf(buf, 64, "%d\n", perf->run);
> ret = simple_read_from_buffer(ubuf, count, offp, buf,
> out_offset);
> kfree(buf);
prev parent reply other threads:[~2016-03-10 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 12:21 [PATCH] ntb: fix possible NULL dereference Sudip Mukherjee
2016-03-10 16:24 ` Jiang, Dave [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=1457627059.3577.34.camel@intel.com \
--to=dave.jiang@intel.com \
--cc=Allen.Hubbe@emc.com \
--cc=jdmason@kudzu.us \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntb@googlegroups.com \
--cc=sudipm.mukherjee@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.