Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp174891ybb; Fri, 27 Mar 2020 19:00:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvFbw+SH2+Sqd0ezZvmbNz/2sqTG3Vd5+1Y7qUkcY1W6HgcwnQNCzBAmziwM3M8rDWJpao7 X-Received: by 2002:aca:fd0d:: with SMTP id b13mr1260960oii.179.1585360803870; Fri, 27 Mar 2020 19:00:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585360803; cv=none; d=google.com; s=arc-20160816; b=IOlFPKFa4qd57SVU/qX/1KsPcuOupf6rQG8VkRpypp9YeXlCYGQNeHMzBj9Q8sTUlA hcSKCcpQLy7rdJkqxiqXKKD1LqPqgAkHUEeBLmZmimZGve2yc2S7Gthege0m8wJS9v4H qKJNWQzCDapFh5JmeWwp5TtrxFJGidXR263ez3UmpsQcC2c8yOdW7+AyE82rCg/uZYGU ixlWSOy7wiviUNQoL0Ij03Ix32W4nRn/ob8wf7JLH7bJ6dxRdERUd5BfvbFo3IZhNpR2 KDcpycLY3UysuabWZ/U7dSa5+jc/ne3ipvf7ncdxc1p6PjrKXga+/uXK7TI3vsQvlyqI 0Vjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=eTeGAui9CcWFWkZ6bCadHMZRTsrEifrYkPur8f91DSQ=; b=OL6z+AVfnMwJveBjjNbiacgL3tnzvKOGtTM7unsCRhR2FbfUlslu109ITFKM3KFf+D DruAxnVkoONGJa9F84bIM+KlAxe6IfBGAOi/DTpJI6SIMcASL14AhkauDir4RFfS3Jze KG885HWuVM1ImdYQXdqpfhuradxyxxAfukgU1JvcKxNak0fieZxhZ173idfQUUTSDcHm V9rIwMa10r37WMT0Y0+KbObj82D6J6crObndmWZ3/ztmA6uRyzeTQSDvKFKDbJ8+PiZl Um3Be2Tv8V5rWKEPAQygfKi8Rwmg0cXYbH4bUfyare9zDj5tcrXdlyxVHouwBvVwWuh3 vsmw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si3219362oto.34.2020.03.27.18.59.50; Fri, 27 Mar 2020 19:00:03 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726518AbgC1B71 (ORCPT + 99 others); Fri, 27 Mar 2020 21:59:27 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12207 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726225AbgC1B71 (ORCPT ); Fri, 27 Mar 2020 21:59:27 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B23F35A41A0DCB2F016E; Sat, 28 Mar 2020 09:59:20 +0800 (CST) Received: from euler.huawei.com (10.175.104.193) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Sat, 28 Mar 2020 09:59:13 +0800 From: Chen Wandun To: , , , , , , , , , CC: Subject: [PATCH next] vt: fix a warning when kmalloc alloc large memory Date: Sat, 28 Mar 2020 10:13:40 +0800 Message-ID: <20200328021340.27315-1-chenwandun@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.193] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the memory size that use kmalloc() to allocate exceed MAX_ORDER pages, it will hit the WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN)), so add memory allocation flag __GFP_NOWARN to silence a warning, othervise, it will cause panic if panic_on_warn is enable. The calltrace is: WARNING: CPU: 1 PID: 6298 at mm/page_alloc.c:4713 __alloc_pages_nodemask+0x339/0x7d0 mm/page_alloc.c:4713 Call Trace: __alloc_pages_nodemask+0x339/0x7d0 mm/page_alloc.c:4713 alloc_pages_current+0xac/0x1e0 mm/mempolicy.c:2211 alloc_pages include/linux/gfp.h:532 [inline] kmalloc_order+0x21/0xf0 mm/slab_common.c:1324 kmalloc_order_trace+0x18/0x150 mm/slab_common.c:1340 kmalloc include/linux/slab.h:560 [inline] vc_uniscr_alloc+0x2b/0xb0 drivers/tty/vt/vt.c:353 vc_do_resize+0x319/0x12b0 drivers/tty/vt/vt.c:1203 vt_ioctl+0xa5f/0x29a0 drivers/tty/vt/vt_ioctl.c:840 tty_ioctl+0x27d/0x1420 drivers/tty/tty_io.c:2660 vfs_ioctl fs/ioctl.c:47 [inline] ksys_ioctl+0xee/0x120 fs/ioctl.c:763 __do_sys_ioctl fs/ioctl.c:772 [inline] __se_sys_ioctl fs/ioctl.c:770 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:770 do_syscall_64+0xa1/0x540 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe Fixes: d8ae72427187 ("vt: preserve unicode values corresponding to screen characters") Signed-off-by: Chen Wandun --- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index bbc26d73209a..2b000b31a351 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -350,7 +350,7 @@ static struct uni_screen *vc_uniscr_alloc(unsigned int cols, unsigned int rows) /* allocate everything in one go */ memsize = cols * rows * sizeof(char32_t); memsize += rows * sizeof(char32_t *); - p = kmalloc(memsize, GFP_KERNEL); + p = kmalloc(memsize, GFP_KERNEL | __GFP_NOWARN); if (!p) return NULL; -- 2.17.1