From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C4DFC433E9 for ; Fri, 15 Jan 2021 21:14:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0BADF2339E for ; Fri, 15 Jan 2021 21:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726025AbhAOVOx (ORCPT ); Fri, 15 Jan 2021 16:14:53 -0500 Received: from smtprelay0188.hostedemail.com ([216.40.44.188]:52778 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725772AbhAOVOw (ORCPT ); Fri, 15 Jan 2021 16:14:52 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 5069A8377A58; Fri, 15 Jan 2021 21:14:11 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: play40_460ea8427532 X-Filterd-Recvd-Size: 2933 Received: from [192.168.1.159] (unknown [47.151.137.21]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Fri, 15 Jan 2021 21:14:10 +0000 (UTC) Message-ID: <1eafe83249cca589b7fa9b2d95d7161e85b0f6e5.camel@perches.com> Subject: Re: [PATCH v5 1/2] tpm: add sysfs exports for all banks of PCR registers From: Joe Perches To: James Bottomley , Greg KH Cc: linux-integrity@vger.kernel.org, Mimi Zohar , Jarkko Sakkinen , linux-api@vger.kernel.org Date: Fri, 15 Jan 2021 13:14:08 -0800 In-Reply-To: References: <20210113232634.23242-1-James.Bottomley@HansenPartnership.com> <20210113232634.23242-2-James.Bottomley@HansenPartnership.com> <7a245c854925c8619eeb02aab6ff32bbccc92ed9.camel@HansenPartnership.com> <23f4bef1fa549f6576aab4f115576601e9f58eaf.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Fri, 2021-01-15 at 13:06 -0800, James Bottomley wrote: > On Fri, 2021-01-15 at 12:48 -0800, Joe Perches wrote: > > On Fri, 2021-01-15 at 10:07 -0800, James Bottomley wrote: > > > On Fri, 2021-01-15 at 09:26 -0800, James Bottomley wrote: > > > > On Fri, 2021-01-15 at 14:54 +0100, Greg KH wrote: > > > > > On Thu, Jan 14, 2021 at 04:21:08PM -0800, James Bottomley > > > > > wrote: > > > > [...] > > > > > > It looks like we already have a couple of bugs in the kernel > > > > > > introduced by this confusion ... return sysfs_emit() vs > > > > > > return > > > > > > sysfs_emit_at() being the most tricky ... > > > > > > > > > > Hm, Joe, you did the conversion to these functions (and wrote > > > > > the > > > > > api), care to review this? > > > > > > > > A cursory glance tells me that summary_show in > > > > drivers/infiniband/hw/usnic/usnic_ib_sysfs.c has a problem, I > > > > think the last = should be += > > > > No, it's correct and overwriting what would otherwise be a trailing > > space. > > The last two lines of summary_show() are > >    len = sysfs_emit_at(buf, len, "\n"); > >    return len; > > So that always returns 2, the length of "\n", 1 rather than 2, but you are otherwise correct. > rather than the length of > everything you just put into buf, which is what sysfs attributes are > supposed to return. Ah, right. My braino mistake. This should not use the sysfs_emit_at return value at all. Patch upcoming...