From patchwork Wed Nov 17 19:39:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Schaefer X-Patchwork-Id: 12625295 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C994C433EF for ; Wed, 17 Nov 2021 19:40:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A39DD61B3A for ; Wed, 17 Nov 2021 19:40:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A39DD61B3A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EC3586B0074; Wed, 17 Nov 2021 14:40:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4B016B0078; Wed, 17 Nov 2021 14:40:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC5026B007B; Wed, 17 Nov 2021 14:40:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id BE30D6B0074 for ; Wed, 17 Nov 2021 14:40:09 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7ABDF18404003 for ; Wed, 17 Nov 2021 19:39:59 +0000 (UTC) X-FDA: 78819437718.21.9EECCC0 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf10.hostedemail.com (Postfix) with ESMTP id C6D786001994 for ; Wed, 17 Nov 2021 19:39:58 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AHIfXwq017422; Wed, 17 Nov 2021 19:39:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=GG0zw38m8UAMNZHTD8EcEiXU/BujDBluyOZnVM89dsA=; b=eA+ii5YvcFd2K9VagMUo+4tERr0KCMLnI5si1Lyfdpbia9dEosgi5LwpB4YEvki6aFyt lT7qAj/rc1qwwaH036tRh9Q/j5YcZCv3ysEFmezWwtRFWRBZOQCBwI7+ptO6wVYtYVXX XIjukA2j5Oc+vZCpV23dZJGqDjWuazl6Ars32Fn7CdtuqMUbqlbKQ4rTLpUH/kUhL7/r LKFLZneM2wYFFBn8Rx5r2dXZoWkzZX3LqwchOlgsEs6pAbVhml5IfCdHby95SzDb7kOz FHME8YnsS18QlG/uzvFP9cNCueIi5BdAv6qabE8GNrGMgiTT0/TnnPmfQxS7AEdu7q3s Cw== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 3cd781h47w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Nov 2021 19:39:56 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1AHJWtlL022503; Wed, 17 Nov 2021 19:39:55 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 3ca50ckwe7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Nov 2021 19:39:54 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1AHJdq3u66584916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Nov 2021 19:39:52 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 825EBAE045; Wed, 17 Nov 2021 19:39:52 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37B1AAE053; Wed, 17 Nov 2021 19:39:52 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 17 Nov 2021 19:39:52 +0000 (GMT) From: Gerald Schaefer To: Faiyaz Mohammed Cc: linux-mm , LKML , linux-s390 , Vlastimil Babka , Greg Kroah-Hartman , Andrew Morton Subject: [RFC PATCH 1/1] mm/slub: fix endless "No data" printing for alloc/free_traces attribute Date: Wed, 17 Nov 2021 20:39:32 +0100 Message-Id: <20211117193932.4049412-2-gerald.schaefer@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211117193932.4049412-1-gerald.schaefer@linux.ibm.com> References: <20211117193932.4049412-1-gerald.schaefer@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yvRbY4G85Vivysos-VQD-eKrumQh25x6 X-Proofpoint-ORIG-GUID: yvRbY4G85Vivysos-VQD-eKrumQh25x6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-17_06,2021-11-17_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 bulkscore=0 clxscore=1015 impostorscore=0 suspectscore=0 phishscore=0 mlxlogscore=787 mlxscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111170084 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C6D786001994 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=eA+ii5Yv; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf10.hostedemail.com: domain of gerald.schaefer@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=gerald.schaefer@linux.ibm.com X-Stat-Signature: 5igoprsywhanrupnkubrwtekcib6q6k4 X-HE-Tag: 1637177998-27223 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Reading from alloc/free_traces attribute in /sys/kernel/debug/slab/ results in an endless sequence of "No data". This is because slab_debugfs_start() does not check for a "past end of file" condition and return NULL. Fix it by adding such a check and return NULL. Fixes: 64dd68497be7 ("mm: slub: move sysfs slab alloc/free interfaces to debugfs") Cc: # v5.14+ Reported-by: Steffen Maier Signed-off-by: Gerald Schaefer --- mm/slub.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/slub.c b/mm/slub.c index f7368bfffb7a..336609671bc2 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -6115,6 +6115,11 @@ static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos) static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos) { + struct loc_track *t = seq->private; + + if (*ppos > t->count) + return NULL; + return ppos; }