From: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Nayna <nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: "moderated list:TPM DEVICE DRIVER"
<tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array
Date: Tue, 11 Oct 2016 21:12:11 +0300 [thread overview]
Message-ID: <20161011181211.GB6900@intel.com> (raw)
In-Reply-To: <57FD1F3C.6070705-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
On Tue, Oct 11, 2016 at 10:49:56PM +0530, Nayna wrote:
>
>
> On 10/11/2016 10:23 PM, Jason Gunthorpe wrote:
> >On Tue, Oct 11, 2016 at 02:23:15PM +0300, Jarkko Sakkinen wrote:
> >>>>+ chip->bios_dir[cnt] =
> >>>> securityfs_create_file("ascii_bios_measurements",
> >>>>- S_IRUSR | S_IRGRP, tpm_dir,
> >>>>+ S_IRUSR | S_IRGRP, chip->bios_dir[0],
> >>>> (void *)&tpm_ascii_b_measurments_seqops,
> >>>> &tpm_bios_measurements_ops);
> >
> >>>>+ if (is_bad(chip->bios_dir[cnt]))
> >>>>+ goto err;
> >
> >>>>+err:
> >>>>+ chip->bios_dir[cnt] = NULL;
> >>>
> >>>The updated patch looks fine.
> >>>Just, I am not sure if NULL assignment is needed.
> >>
> >>It's not needed.
> >
> >It is required to switch an ERR_PTR to NULL, see is_bad()
>
> My understanding is that securityfs_remove() takes care of both NULL and
> ERR_PTR().
>
> From securityfs_remove():
>
> if (!dentry || IS_ERR(dentry))
> return;
Right. I just checked from LXR. Seems weird that they have that kind of
special handling for IS_ERR. Checking for NULL is more usual. I think I
keep setting NULL anyway if nothing else for robustness. Anyway, thanks
for pointing this out.
> Thanks & Regards,
> - Nayna
/Jarkko
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Nayna <nayna@linux.vnet.ibm.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
Peter Huewe <peterhuewe@gmx.de>,
Marcel Selhorst <tpmdd@selhorst.net>,
"moderated list:TPM DEVICE DRIVER"
<tpmdd-devel@lists.sourceforge.net>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array
Date: Tue, 11 Oct 2016 21:12:11 +0300 [thread overview]
Message-ID: <20161011181211.GB6900@intel.com> (raw)
In-Reply-To: <57FD1F3C.6070705@linux.vnet.ibm.com>
On Tue, Oct 11, 2016 at 10:49:56PM +0530, Nayna wrote:
>
>
> On 10/11/2016 10:23 PM, Jason Gunthorpe wrote:
> >On Tue, Oct 11, 2016 at 02:23:15PM +0300, Jarkko Sakkinen wrote:
> >>>>+ chip->bios_dir[cnt] =
> >>>> securityfs_create_file("ascii_bios_measurements",
> >>>>- S_IRUSR | S_IRGRP, tpm_dir,
> >>>>+ S_IRUSR | S_IRGRP, chip->bios_dir[0],
> >>>> (void *)&tpm_ascii_b_measurments_seqops,
> >>>> &tpm_bios_measurements_ops);
> >
> >>>>+ if (is_bad(chip->bios_dir[cnt]))
> >>>>+ goto err;
> >
> >>>>+err:
> >>>>+ chip->bios_dir[cnt] = NULL;
> >>>
> >>>The updated patch looks fine.
> >>>Just, I am not sure if NULL assignment is needed.
> >>
> >>It's not needed.
> >
> >It is required to switch an ERR_PTR to NULL, see is_bad()
>
> My understanding is that securityfs_remove() takes care of both NULL and
> ERR_PTR().
>
> From securityfs_remove():
>
> if (!dentry || IS_ERR(dentry))
> return;
Right. I just checked from LXR. Seems weird that they have that kind of
special handling for IS_ERR. Checking for NULL is more usual. I think I
keep setting NULL anyway if nothing else for robustness. Anyway, thanks
for pointing this out.
> Thanks & Regards,
> - Nayna
/Jarkko
next prev parent reply other threads:[~2016-10-11 18:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 19:25 [PATCH RESEND 0/3] Clean up handling of event log files Jarkko Sakkinen
2016-10-01 19:25 ` Jarkko Sakkinen
2016-10-01 19:25 ` [PATCH RESEND 1/3] tpm: define a generic open() method for ascii & bios measurements Jarkko Sakkinen
2016-10-01 19:25 ` Jarkko Sakkinen
[not found] ` <1475349926-476-2-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-10-08 10:56 ` Jarkko Sakkinen
2016-10-08 10:56 ` Jarkko Sakkinen
[not found] ` <1475349926-476-1-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-10-01 19:25 ` [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array Jarkko Sakkinen
2016-10-01 19:25 ` Jarkko Sakkinen
[not found] ` <1475349926-476-3-git-send-email-jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-10-02 21:28 ` Jason Gunthorpe
2016-10-02 21:28 ` Jason Gunthorpe
2016-10-03 12:21 ` Jarkko Sakkinen
[not found] ` <20161003122135.GB9990-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-10-08 11:01 ` Jarkko Sakkinen
2016-10-08 11:01 ` Jarkko Sakkinen
2016-10-10 18:53 ` Nayna
2016-10-10 18:53 ` Nayna
[not found] ` <57FBE39B.2030301-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-10-11 11:23 ` Jarkko Sakkinen
2016-10-11 11:23 ` Jarkko Sakkinen
[not found] ` <20161011112315.GB21688-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-10-11 16:53 ` Jason Gunthorpe
2016-10-11 16:53 ` Jason Gunthorpe
2016-10-11 17:19 ` Nayna
[not found] ` <57FD1F3C.6070705-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-10-11 18:12 ` Jarkko Sakkinen [this message]
2016-10-11 18:12 ` Jarkko Sakkinen
[not found] ` <20161011165355.GB6881-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-11 18:09 ` Jarkko Sakkinen
2016-10-11 18:09 ` Jarkko Sakkinen
2016-10-01 19:25 ` [PATCH RESEND 3/3] tpm: drop tpm1_chip_register(/unregister) Jarkko Sakkinen
2016-10-01 19:25 ` Jarkko Sakkinen
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=20161011181211.GB6900@intel.com \
--to=jarkko.sakkinen-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 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.