Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp572466imu; Wed, 23 Jan 2019 01:36:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN67QGI0ncee7bOdaESuiPbi9NZBdMrG1kgITc7dCHHoGedFIMyaF9vZcCi5shf/A2XLWtJi X-Received: by 2002:a17:902:74cc:: with SMTP id f12mr1542800plt.134.1548236219153; Wed, 23 Jan 2019 01:36:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548236219; cv=none; d=google.com; s=arc-20160816; b=MVzfJihxyCqy4PM1QKtdyzR8KN8WXVW97YDriUoEkI/NDvaLUP/P7vJb3GQ7HyC3Mu Waz1T/fdtUMx7RYQJ982B2818H0SG1YLPZ00wIFSPn6yeZQCBReS4Srbi5GVfLtpWQ2s HlcpuBV1Vuyufp0BrFaN9P+iu8tHQHoWfQpDSlvjcAXj/lQEL8Xwiyca2ZS6VqDuBcqR 6uw1msLqOtRABrxOAEAYcOFm3UO5Icza7YeNcYkL2KBuwlo7nTpzUTGBEIOeHVYbaKXx spK+a88fIdD9cyZ8FCH5+nKFgPO20WDPMwY85nI54wOW+rn7INWd3nBl9I/q6wa4Svv7 YYfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:message-id:in-reply-to:mime-version :references:subject:cc:to:from:date; bh=zIWJTjkL52OQJynGZRyw7vNj4hPIqqbcECqP1kLttlg=; b=txmXH8tEwaRiGz73N7govxOmDsodWMy6GNhYDpfx5NhULTnZ4XVh5QqW/UU+Z4k0ge qKHyQFaKGbyhACKzGv/96V44G6xCMzA2wjaS/x18pmPifN/pKIptpdUIWQHo2aogNKfw 6DdnOW5r7bXpK1xwXba3ATl0bbCxB+tHCPB1o1PqRWZS3NO9q7U2RG601X+uH5VPFLFf D6wI62xTDwHncD+ZSfv3JP5RmPurvb4YeWkGxin4Snntvfrg2xegCZrumiSx6JrsXJIr OVxhhahW9bQK0b5Lf6uGYeb7HEtcKg7yRr5A+JqIP5Dre/pUyypbrLuD7QEfIOm6YxTw QT+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cd2si19507351plb.39.2019.01.23.01.36.43; Wed, 23 Jan 2019 01:36:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727150AbfAWJfR (ORCPT + 99 others); Wed, 23 Jan 2019 04:35:17 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36086 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726207AbfAWJfR (ORCPT ); Wed, 23 Jan 2019 04:35:17 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0N9VQKk137432 for ; Wed, 23 Jan 2019 04:35:15 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2q6mfj31t0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 23 Jan 2019 04:35:15 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 23 Jan 2019 09:35:14 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 23 Jan 2019 09:35:11 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0N9ZA1O56557616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 23 Jan 2019 09:35:10 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 52327AE057; Wed, 23 Jan 2019 09:35:10 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16EA7AE051; Wed, 23 Jan 2019 09:35:10 +0000 (GMT) Received: from osiris (unknown [9.152.212.95]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 23 Jan 2019 09:35:10 +0000 (GMT) Date: Wed, 23 Jan 2019 10:35:08 +0100 From: Heiko Carstens To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Martin Schwidefsky , Kees Cook , Christian Borntraeger , Hendrik Brueckner , linux-s390@vger.kernel.org Subject: Re: [PATCH] s390: kernel: no need to check return value of debugfs_create functions References: <20190122152151.16139-3-gregkh@linuxfoundation.org> <20190122162454.GA31034@osiris> <20190122163337.GB23510@kroah.com> MIME-Version: 1.0 In-Reply-To: <20190122163337.GB23510@kroah.com> X-TM-AS-GCONF: 00 x-cbid: 19012309-4275-0000-0000-00000302F71D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19012309-4276-0000-0000-000038112AD8 Message-Id: <20190123093508.GB3424@osiris> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-23_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901230072 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 22, 2019 at 05:33:37PM +0100, Greg Kroah-Hartman wrote: > On Tue, Jan 22, 2019 at 05:24:54PM +0100, Heiko Carstens wrote: > > On Tue, Jan 22, 2019 at 04:21:02PM +0100, Greg Kroah-Hartman wrote: > > > When calling debugfs functions, there is no need to ever check the > > > return value. The function can work or not, but the code logic should > > > never do something different based on this. > > > > > > Cc: Martin Schwidefsky > > > Cc: Heiko Carstens > > > Cc: Kees Cook > > > Cc: Christian Borntraeger > > > Cc: Hendrik Brueckner > > > Cc: linux-s390@vger.kernel.org > > > Signed-off-by: Greg Kroah-Hartman > > > --- > > > arch/s390/kernel/debug.c | 6 ------ > > > arch/s390/kernel/kdebugfs.c | 2 -- > > > arch/s390/kernel/sysinfo.c | 2 -- > > > 3 files changed, 10 deletions(-) > > > diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c > > > index 12f80d1f0415..2ac3c9b56a13 100644 > > > --- a/arch/s390/kernel/sysinfo.c > > > +++ b/arch/s390/kernel/sysinfo.c > > > @@ -545,8 +545,6 @@ static __init int stsi_init_debugfs(void) > > > int lvl, i; > > > > > > stsi_root = debugfs_create_dir("stsi", arch_debugfs_dir); > > > - if (IS_ERR_OR_NULL(stsi_root)) > > > - return 0; > > > > No objections, however will you also change the odd behaviour that > > e.g. debugfs_create_file() returns -ENODEV instead of (the expected) > > NULL pointer if CONFIG_DEBUGFS is disabled? > > Nope. That is intentional. > > > I do remember this since it caused at least one crash ;) > > Which is why you shouldn't care about the return value of these > functions :) > > > 19cdd08ba155 ("[S390] qdio: fix broken pointer in case of CONFIG_DEBUG_FS is disabled"). > > Odd, what crashes when passed an error pointer? What was someone trying > to do with those pointers? The only thing you can do with a return > value from a debugfs function is to pass it back into another debugfs > call. Sounds like someone wasn't doing that :( I think it used to be this code that crashed: static void remove_debugfs_entry(struct qdio_q *q) { int i; for (i = 0; i < MAX_DEBUGFS_QUEUES; i++) { if (!debugfs_queues[i]) continue; -----> if (debugfs_queues[i]->d_inode->i_private == q) { debugfs_remove(debugfs_queues[i]); debugfs_queues[i] = NULL; } } } Which looks like a layering violation anyway. However this code is gone, so everything should be fine.