From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753940AbcJKRU0 (ORCPT ); Tue, 11 Oct 2016 13:20:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57999 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752588AbcJKRUZ (ORCPT ); Tue, 11 Oct 2016 13:20:25 -0400 Subject: Re: [PATCH RESEND 2/3] tpm: replace dynamically allocated bios_dir with a static array To: Jason Gunthorpe , Jarkko Sakkinen References: <1475349926-476-1-git-send-email-jarkko.sakkinen@linux.intel.com> <1475349926-476-3-git-send-email-jarkko.sakkinen@linux.intel.com> <57FBE39B.2030301@linux.vnet.ibm.com> <20161011112315.GB21688@intel.com> <20161011165355.GB6881@obsidianresearch.com> Cc: Peter Huewe , Marcel Selhorst , "moderated list:TPM DEVICE DRIVER" , open list From: Nayna Date: Tue, 11 Oct 2016 22:49:56 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20161011165355.GB6881@obsidianresearch.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101117-0028-0000-0000-000005C9A94F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005893; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00766989; UDB=6.00366925; IPR=6.00543131; BA=6.00004801; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012950; XFM=3.00000011; UTC=2016-10-11 17:20:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101117-0029-0000-0000-00002FF25604 Message-Id: <57FD1F3C.6070705@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-11_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610110297 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >