Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5581324imm; Mon, 23 Jul 2018 02:13:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfvxafsqfzNddXN9yG2q52BUqCQsuG/eg976V33guevbmBITWizi0TwL1P54yf6CgRu03u1 X-Received: by 2002:a63:5e45:: with SMTP id s66-v6mr11439511pgb.151.1532337212246; Mon, 23 Jul 2018 02:13:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532337212; cv=none; d=google.com; s=arc-20160816; b=SeA4StR43o3C00tO1FXeitTMCv9ybwXBuz2Vxji6qi/bYfol6fhvCkb1MCMY0hhs4n tLuO0ptovFdCup6eVDO+lbS/KIJf7PwduKRa+QIP3dBy0i5Cj78BHkJCu2bKlvsEIpR1 OkUisMcJN+9eywZa7Ij/hON1S+9okWJRwPOffZ0kaAs6ZOxS7Pnuz/2v0IW1EwbsbfNz g5RHGWaMOiI5Jv+sE9wFRVV1eoCQq6uCEU2ZLIS6T5WhDaAyuwb1yCXP7uL1rAEVoPgG nBuD/iKTPE/Xe6FyQtAjvlG6lsTIBJTcZBs1HwppIVi+feLeHQId4NyuypRO6j1nD00y kuzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=g/A0HXvTyptqquHi8iOsgkwG8Ne7mVwyujgbPwC35DU=; b=vvXgr5HmQhygbAdqtK+QEBBtCLEbazSICugVjJqjAe3RdhDzaNVjgW5G1QE6+/QDCf ooEgjvUyMl2zejIPxOkHjRuAn4L/xR6i3begRmThbBQl3vRsilCmjpPTMATs4CSQL0zC qDdv/ctddFmUKKKubaIW/MNGcPSYj0h7+9Oko6bWqd8c/NeMDkO6148VhSKb/hGg1X/h iavxliTWrU3PNYzl+DayXEF4Q4y2jfIR7hu1jQlDxMsQJvmLphWX1qSMU9rijbNcWQ9x yCkl7fbxt+V/YUb2/OQsxAkJyEqoou1rWwrOVeNWDA49IdiyhkLqKf8UgFiwiBsOd/gP O+yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="o+S/QOxx"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f26-v6si8490741pgf.10.2018.07.23.02.13.17; Mon, 23 Jul 2018 02:13:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="o+S/QOxx"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388129AbeGWKMG (ORCPT + 99 others); Mon, 23 Jul 2018 06:12:06 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:55778 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388069AbeGWKMF (ORCPT ); Mon, 23 Jul 2018 06:12:05 -0400 Received: by mail-it0-f68.google.com with SMTP id 16-v6so403718itl.5 for ; Mon, 23 Jul 2018 02:11:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=g/A0HXvTyptqquHi8iOsgkwG8Ne7mVwyujgbPwC35DU=; b=o+S/QOxxea5lCeCP3sOnPn+zagpgiuWNnD3QtWejVFfUDKxgucyFWXOQm+d9SZGECQ n++rBlKryxT5BKANr2IX7lwPY+4reA6LrhSE0sjxcR8hQmFLr1DwphVRWvS4argpjhn+ 1ZuKPilv1hQ0f8eNN/fw1501tNmoYelCACQa86Z0c3OcjyPjVMmY8IIjow+mVsSAlCwA cM4GRp3sXI819VdWwi7VoGUZI+6VDCKCTSKZN7ais5KCF/qi+Enf9kMnEhtHq0gX7W4B aMsikN4ItExbSfcyAMhtalpNKzTI1uVmP58FCthX22/8/N/d+1goWws3aJ2b2CcXXk9a JsFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=g/A0HXvTyptqquHi8iOsgkwG8Ne7mVwyujgbPwC35DU=; b=kbdGOhXJrRTa4GkreXOh9BRtIUw82I6XFbJ/j5KktSPMBLhv4XlOKU4wmR3w6fEmqD qd+3NjzzLLkDGjAN+fNkOytKuXFFwFlV4KCnIEcgWC3ePT6+5MZ0x5dRYCMZ0o5cFHIM 5xU1M7yi8Fu2AhYDDBGhDpk9qoTG+8rQ0q2sMcSXWW0bGx6l1DfHb0RCuMaZJffomRq0 aK2gz7v1Nzw5BkpVArHjNx3ioL7AxxyHQ50jb/vw11b+ws4Yr3iv4WUC9sBfTaCOuKoW YrdcZpfl4h0vCq2R5KbommicJI+wcDbkx1T+rT8r8D0jDeAl7J3EQVgJdv3lQ+aUkIlx UdIQ== X-Gm-Message-State: AOUpUlF8SoPt2akhvyFAakgKqhclmZgEoxj9p7DgF0gsq+9NxhuoqJfw sr4vHWH95l1CXhKvMIERVkg= X-Received: by 2002:a02:503:: with SMTP id e3-v6mr11127241jad.29.1532337112546; Mon, 23 Jul 2018 02:11:52 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:e422:450a:e730:728b]) by smtp.gmail.com with ESMTPSA id z71-v6sm6409540ioz.34.2018.07.23.02.11.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 02:11:52 -0700 (PDT) From: Jia-Ju Bai To: bernhard.walle@gmx.de Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] firmware: memmap: Replace GFP_ATOMIC with GFP_KERNEL in firmware_map_add_hotplug() Date: Mon, 23 Jul 2018 17:11:45 +0800 Message-Id: <20180723091146.11233-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org firmware_map_add_hotplug() is only called by add_memory_resource(), which is never called in atomic context. firmware_map_add_hotplug() calls kzalloc() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. I also manually check the kernel code before reporting it. Signed-off-by: Jia-Ju Bai --- drivers/firmware/memmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c index 5de3ed29282c..598eb0511097 100644 --- a/drivers/firmware/memmap.c +++ b/drivers/firmware/memmap.c @@ -297,7 +297,7 @@ int __meminit firmware_map_add_hotplug(u64 start, u64 end, const char *type) entry = firmware_map_find_entry_bootmem(start, end - 1, type); if (!entry) { - entry = kzalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC); + entry = kzalloc(sizeof(struct firmware_map_entry), GFP_KERNEL); if (!entry) return -ENOMEM; } else { -- 2.17.0