Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1499030

Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array

From Nayna <nayna@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array
Date 2016-10-11 19:30 +0200
Message-ID <sr92h-15w-1@gated-at.bofh.it> (permalink)
References <sny8V-4tY-3@gated-at.bofh.it> <sny8V-4tY-1@gated-at.bofh.it> <sqNXP-4MD-7@gated-at.bofh.it> <sr3pU-666-19@gated-at.bofh.it> <sr92h-15w-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



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;

Thanks & Regards,
   - Nayna

>
> The original version that used a counter in chip did not need it.
>
> Jason
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RESEND 0/3] Clean up handling of event log files Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-01 21:30 +0200
  [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-01 21:30 +0200
    Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-10-02 23:30 +0200
      Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-03 14:30 +0200
        Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-08 13:10 +0200
    Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Nayna <nayna@linux.vnet.ibm.com> - 2016-10-10 21:00 +0200
      Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-11 13:30 +0200
        Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Nayna <nayna@linux.vnet.ibm.com> - 2016-10-11 19:30 +0200
          Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-11 20:20 +0200
        Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-10-11 19:40 +0200
          Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir  with a static array Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-11 20:20 +0200
  [PATCH RESEND 3/3] tpm: drop tpm1_chip_register(/unregister) Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-01 21:30 +0200
  [PATCH RESEND 1/3] tpm: define a generic open() method for ascii & bios measurements Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-01 21:30 +0200
    Re: [PATCH RESEND 1/3] tpm: define a generic open() method for ascii  & bios measurements Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-10-08 13:10 +0200

csiph-web