Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58224C636CC for ; Tue, 31 Jan 2023 15:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbjAaPVF (ORCPT ); Tue, 31 Jan 2023 10:21:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232417AbjAaPUi (ORCPT ); Tue, 31 Jan 2023 10:20:38 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5AAB58650; Tue, 31 Jan 2023 07:18:32 -0800 (PST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30VFEQZv021534; Tue, 31 Jan 2023 15:18:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=rvXOTcorzfsPEZ+ryU4QPusMRu8sCurgU5JTFn+aGds=; b=E4TVAEsWfzZATUv6zEYRMV8l35xqm4G4NHk6XgrM+1jDGNtl18/AfXF8OFqEpUaF8zBh a7jvqnpzhLlJPI7pXjOkbjoh32S57thyVRC1k+H532KsjhXPYtzmzxnklyW1VUQwYah/ 6Y2+VH5Zz86DcMDSx9GKuLQk9w9vJ+G+tlBRRIGplgzPkcAwh4SxxJQwUlUkIax7mCFY 8YCYaeayZyghMlAr8GWqtluIaYYiKiiYpkoDSdlm9I04wOk83OSelikRyABh/umhhfGg kMLXvHsor6DVKBSgNMBt1Fvt+Gsw7VeN3lvqN9qTKo/nOdUdHX3D8bFPIE4FdC3ChEhF 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nf3q7u9fp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 31 Jan 2023 15:18:23 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30VFINqV005731; Tue, 31 Jan 2023 15:18:23 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nf3q7u9f5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 31 Jan 2023 15:18:22 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30VBqvNx012321; Tue, 31 Jan 2023 15:18:21 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3ncvvdgmx6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 31 Jan 2023 15:18:21 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30VFIKS89634308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 31 Jan 2023 15:18:20 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17A025805A; Tue, 31 Jan 2023 15:18:20 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9287558056; Tue, 31 Jan 2023 15:18:18 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 31 Jan 2023 15:18:16 +0000 (GMT) Message-ID: <1f633865-d695-467a-b240-135c4887329b@linux.ibm.com> Date: Tue, 31 Jan 2023 10:18:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v5 03/25] powerpc/secvar: Fix incorrect return in secvar_sysfs_load() Content-Language: en-US To: Andrew Donnellan , linuxppc-dev@lists.ozlabs.org, linux-integrity@vger.kernel.org Cc: ruscur@russell.cc, bgray@linux.ibm.com, nayna@linux.ibm.com, gcwilson@linux.ibm.com, gjoyce@linux.ibm.com, brking@linux.ibm.com, sudhakar@linux.ibm.com, erichte@linux.ibm.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, zohar@linux.ibm.com, joel@jms.id.au, npiggin@gmail.com References: <20230131063928.388035-1-ajd@linux.ibm.com> <20230131063928.388035-4-ajd@linux.ibm.com> From: Stefan Berger In-Reply-To: <20230131063928.388035-4-ajd@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 5YSa_VDEKuKGJ_q9Zz75dLFr4NGPLh8X X-Proofpoint-GUID: iVnyRJPoLkRZxLtWDDD7up2F6roNL-Vz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-31_08,2023-01-31_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301310135 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/31/23 01:39, Andrew Donnellan wrote: > From: Russell Currey > > secvar_ops->get_next() returns -ENOENT when there are no more variables > to return, which is expected behaviour. > > Fix this by returning 0 if get_next() returns -ENOENT. > > This fixes an issue introduced in commit bd5d9c743d38 ("powerpc: expose > secure variables to userspace via sysfs"), but the return code of > secvar_sysfs_load() was never checked so this issue never mattered. > > Signed-off-by: Russell Currey > Signed-off-by: Andrew Donnellan > > --- > > v5: New patch > --- > arch/powerpc/kernel/secvar-sysfs.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c > index 1ee4640a2641..7fa5f8ed9542 100644 > --- a/arch/powerpc/kernel/secvar-sysfs.c > +++ b/arch/powerpc/kernel/secvar-sysfs.c > @@ -179,8 +179,10 @@ static int secvar_sysfs_load(void) > rc = secvar_ops->get_next(name, &namesize, NAME_MAX_SIZE); > if (rc) { > if (rc != -ENOENT) > - pr_err("error getting secvar from firmware %d\n", > - rc); > + pr_err("error getting secvar from firmware %d\n", rc); > + else > + rc = 0; > + > break; > } > Reviewed-by: Stefan Berger