From patchwork Fri Nov 23 07:21:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10695091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 492F016B1 for ; Fri, 23 Nov 2018 07:22:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D6832BB1C for ; Fri, 23 Nov 2018 07:22:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 212C92BC1F; Fri, 23 Nov 2018 07:22:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1AEB2BBA9 for ; Fri, 23 Nov 2018 07:22:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C31286B2FE0; Fri, 23 Nov 2018 02:22:12 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BE0C76B2FE1; Fri, 23 Nov 2018 02:22:12 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAB896B2FE2; Fri, 23 Nov 2018 02:22:12 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) by kanga.kvack.org (Postfix) with ESMTP id 7C5596B2FE0 for ; Fri, 23 Nov 2018 02:22:12 -0500 (EST) Received: by mail-io1-f72.google.com with SMTP id k3-v6so10313340ioq.8 for ; Thu, 22 Nov 2018 23:22:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:date:from:to:cc:subject :message-id:mime-version:content-disposition:user-agent; bh=1SKC4ToSRtxX7WYQvO9IGJ/3JnKdtEdhXnpkUxdw/4s=; b=NbI+XLCm+YOzh5SwKtnLwJ+PU5dLW+f6Le1fCOjPPcw27uuVNFOerdNh4iw7hl1ASv AUkk4jTJ4TbKl3qYLwpNbqepKafUYnDeQsPR/h39/jik5yG2qisjNl1j9yBtbeeVczO3 HrocX+QHXqGWg73yaAmRAaebi4PxTWwT2nhHGIqT/96zVApaIKDdjYO5jEIiiZijPCWE Bq6zidXSKM/5gGRjyGPG5Xs7vjN08viT/Fn2ahNsdKXJDBHjzWpzgjselYcwd8vWNc/H nrOUu46rGZ6sg6SEA3cJPvULbpyA083DVCXTvzDOif+v7ijOsSeOmowDN4cjwTY434xn eaPg== X-Gm-Message-State: AGRZ1gLYzuIm/tsKUHaVd7o7YbfuZFtUh6KlTmtxEXjky/qT19AbBBKk +TiFrr99h4DV4Vp6GK4Jb/VsADgBFYMXn7XYU0/F53VHbB4QvfWliP+h/8Irq01o+pO6XOk6qwG eiUmLcjPpi9Iq8P1qhSiVDTs7kI4xD/gthyJ1o3f/9296dwnd1YgPfQkO4N4FXOFFFg== X-Received: by 2002:a24:ac53:: with SMTP id m19-v6mr11348071iti.147.1542957732223; Thu, 22 Nov 2018 23:22:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/VmpUDoVKmzHqYSV2/IaE3+xyxqoj2zGe7q+ZczZP2V3dxFq3HYFfG3DwKlLWWs1/Qy3bl2 X-Received: by 2002:a24:ac53:: with SMTP id m19-v6mr11348048iti.147.1542957731472; Thu, 22 Nov 2018 23:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542957731; cv=none; d=google.com; s=arc-20160816; b=Tno6Hjnf+yexeTfz3enwvu8xMD+wXL/w1XR17pPrb2yTFpCiL5EQr0R+8DM/V22MrJ CDjQSEgVOa0nTIgUwbaKtv4y/4+25AJ6RgGvqP9qAbFyK5gOGjzjYHkDwHyeGW96QWXx GDxScGJKUE9RIOi/1d+ztD5sm8BT+y8VdNFgaQsPoyz+6AyNoU+aAnNRKmb4VZdiWTr+ wLUt17jUfiTcmlNYXAYnlyisc7Jq6JbFmdWuq35ufq5GIy/aY3/Z59qBxkuC4bPSsM2y 3mvzfF2FVcTQEpgYPYQR9CzW8KAjhba42pCeZgTUKQyeu1zsC/6PebVGmskmmUTWV4/g LEbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:dkim-signature; bh=1SKC4ToSRtxX7WYQvO9IGJ/3JnKdtEdhXnpkUxdw/4s=; b=wBpLolC+QKMi4sNovWuxMkKatpdlBCydCmYiioCFqpymS4lJeAhpeVKGb08ZbLAgoP fxTuoHquMyS3udstDLalqMvYiAsyku809KKt7cDFjqv4VulfYYvdiaW0VUHzB7X8Pg/h 40jTKw8T9rsLvQ4ntms5IKkJoApZgi1IZZ6Brk+a6+fAydhuAScpOi+IOybLY77SQ8Qs bCBzEM84YhHYQ00mRkxef1MbrfgVargadZF+JL+LzeX06a0IpoMvNAfSeZVU7TlpCSch JGP48CdITH0uDeYfFc35PcuRt9BFOMYfTg0rUDM6aM+4QoM7Oq31S5ndEU+DJ2+c0RMF LutQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=bmOQ2Ok7; spf=pass (google.com: domain of dan.carpenter@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=dan.carpenter@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2130.oracle.com (userp2130.oracle.com. [156.151.31.86]) by mx.google.com with ESMTPS id v8si12406189iol.153.2018.11.22.23.22.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 23:22:11 -0800 (PST) Received-SPF: pass (google.com: domain of dan.carpenter@oracle.com designates 156.151.31.86 as permitted sender) client-ip=156.151.31.86; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=bmOQ2Ok7; spf=pass (google.com: domain of dan.carpenter@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=dan.carpenter@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAN7Jfqo038474; Fri, 23 Nov 2018 07:21:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=1SKC4ToSRtxX7WYQvO9IGJ/3JnKdtEdhXnpkUxdw/4s=; b=bmOQ2Ok7uzkGieB+jO0GTIFyjSXA2juZC8i0K0wULyQqhWfmsQ4ZnX5qbaOb+k9nwH7V 83+XN6ZrWPmFRDYzo0cP34LjenNmpOCD1Eoyt/YYk+JCqLdhEGvdTyci5f/Z9CoIB26z HZ9EzvPdNMS5dxdErpA3VCKNL+H0uRCk9Aors/399H6+1zN0w2EfnKrWI6YYl9wP00nx PzlhAlsNU7MpG2xLP4lLxcI0Q0rOX0buuY3XDLN/k1wZH0+fOXyt8jQN/iNVvlRUnJbl lSjZW9hizY8UcDwyREzWO9TQyKQj7DDu5C8twspgLvBfp7Gpi7cCYpk3cAfWT/df32ty Zg== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ntadu9fjk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Nov 2018 07:21:50 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAN7LiHY004021 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Nov 2018 07:21:44 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAN7LiSZ031256; Fri, 23 Nov 2018 07:21:44 GMT Received: from kili.mountain (/197.157.0.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Nov 2018 23:21:43 -0800 Date: Fri, 23 Nov 2018 10:21:35 +0300 From: Dan Carpenter To: Andrew Morton , Michal Hocko Cc: Pavel Tatashin , Alexander Duyck , Matthew Wilcox , linux-mm@kvack.org, kernel-janitors@vger.kernel.org Subject: [PATCH] mm: debug: Fix a width vs precision bug in printk Message-ID: <20181123072135.gqvblm2vdujbvfjs@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9085 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811230058 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: X-Virus-Scanned: ClamAV using ClamSMTP We had intended to only print dentry->d_name.len characters but there is a width vs precision typo so if the name isn't NUL terminated it will read past the end of the buffer. Fixes: 408ddbc22be3 ("mm: print more information about mapping in __dump_page") Signed-off-by: Dan Carpenter Reviewed-by: Anshuman Khandual Acked-by: Michal Hocko Reviewed-by: David Hildenbrand --- mm/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/debug.c b/mm/debug.c index d18c5cea3320..faf856b652b6 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -80,7 +80,7 @@ void __dump_page(struct page *page, const char *reason) if (mapping->host->i_dentry.first) { struct dentry *dentry; dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias); - pr_warn("name:\"%*s\" ", dentry->d_name.len, dentry->d_name.name); + pr_warn("name:\"%.*s\" ", dentry->d_name.len, dentry->d_name.name); } } BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);