linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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

  reply	other threads:[~2016-10-11 18:12 UTC|newest]

Thread overview: 14+ 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 ` [PATCH RESEND 1/3] tpm: define a generic open() method for ascii & bios measurements Jarkko Sakkinen
2016-10-08 10:56   ` Jarkko Sakkinen
2016-10-01 19:25 ` [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array Jarkko Sakkinen
2016-10-02 21:28   ` Jason Gunthorpe
2016-10-03 12:21     ` Jarkko Sakkinen
2016-10-08 11:01       ` Jarkko Sakkinen
2016-10-10 18:53   ` Nayna
2016-10-11 11:23     ` Jarkko Sakkinen
2016-10-11 16:53       ` Jason Gunthorpe
2016-10-11 17:19         ` Nayna
2016-10-11 18:12           ` Jarkko Sakkinen [this message]
2016-10-11 18:09         ` Jarkko Sakkinen
2016-10-01 19:25 ` [PATCH RESEND 3/3] tpm: drop tpm1_chip_register(/unregister) 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@linux.intel.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nayna@linux.vnet.ibm.com \
    --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;
as well as URLs for NNTP newsgroup(s).