From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Kiran Padwal <kiran.padwal@smartplayin.com>
Cc: peterhuewe@gmx.de, ashley@ashleylai.com, tpmdd@selhorst.net,
kiran.padwal21@gmail.com, tpmdd-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH] char: tpm: Add missing error check for devm_kzalloc
Date: Wed, 24 Sep 2014 10:22:33 -0600 [thread overview]
Message-ID: <20140924162233.GB8898@obsidianresearch.com> (raw)
In-Reply-To: <1411110879-4106-1-git-send-email-kiran.padwal@smartplayin.com>
On Fri, Sep 19, 2014 at 12:44:39PM +0530, Kiran Padwal wrote:
> Currently these driver are missing a check on the return value of devm_kzalloc,
> which would cause a NULL pointer dereference in a OOM situation.
>
> This patch adds a missing check for tpm_i2c_atmel.c and tpm_i2c_nuvoton.c
Yes, my bad, thank you:
Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
> drivers/char/tpm/tpm_i2c_atmel.c | 4 ++++
> drivers/char/tpm/tpm_i2c_nuvoton.c | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
> index 7727292..503a85a 100644
> +++ b/drivers/char/tpm/tpm_i2c_atmel.c
> @@ -168,6 +168,10 @@ static int i2c_atmel_probe(struct i2c_client *client,
>
> chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data),
> GFP_KERNEL);
> + if (!chip->vendor.priv) {
> + rc = -ENOMEM;
> + goto out_err;
> + }
>
> /* Default timeouts */
> chip->vendor.timeout_a = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT);
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index 7b158ef..23c7b13 100644
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -538,6 +538,11 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
>
> chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data),
> GFP_KERNEL);
> + if (!chip->vendor.priv) {
> + rc = -ENOMEM;
> + goto out_err;
> + }
> +
> init_waitqueue_head(&chip->vendor.read_queue);
> init_waitqueue_head(&chip->vendor.int_queue);
>
next prev parent reply other threads:[~2014-09-24 16:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-19 7:14 Kiran Padwal
2014-09-24 16:22 ` Jason Gunthorpe [this message]
2014-12-02 20:51 ` Peter Hüwe
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=20140924162233.GB8898@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=ashley@ashleylai.com \
--cc=kiran.padwal21@gmail.com \
--cc=kiran.padwal@smartplayin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=tpmdd-devel@lists.sourceforge.net \
--cc=tpmdd@selhorst.net \
/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®