From patchwork Thu Mar 8 08:00:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 130976 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp6176662lja; Thu, 8 Mar 2018 00:04:05 -0800 (PST) X-Google-Smtp-Source: AG47ELv9SOI5wsdTfiZmmf+OCo51RCf/ui4wWXAenj7YMxhK8vo/6Y1nWgvbC5IUvNRXeRU8uxrP X-Received: by 10.99.173.79 with SMTP id y15mr20341381pgo.136.1520496245013; Thu, 08 Mar 2018 00:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520496245; cv=none; d=google.com; s=arc-20160816; b=WD0T5wUuW0CFmPIca9PCrrNvSAfbiwok+lX4F5BRz7iywKBI4PhUexCL7CFjjn4ogd hAqZkK1mYnDApz70DFhASPPBdSaWQE40Z5svHEXof/Uoc/ELvxOu2KlhYFDz9VsiWn/X QOWZAdbmR2/n2lyFnS8m2PV9FjxFXf1ofotu8ckXbs7E6yTyQcU/QQcwKKyu0Mcv+SmP sjTFnltQscg6jpbSAPCf8NyfLeeYaCtGZ0G0CHZZTDdB9UAnqDHPsjTy7sEuEN+Bu6uD Gva45w4Wq/OmNK/lzaRo8caWXO7xSc4RPJiIrVrrIgEn2IvmBJ6rh6Cp47cGvws4iQKI yE/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MRLim3ZkIfbDgyR1+KCSDkYZPlgoQqYoYVCXNi6qz1g=; b=WfbsZw9vNxIGMNIARM0xaQ71tu+RUgmd3SV+2zXU5X2O9JTvMMIP2TglAyz/DyE6qO GWrPSCm0gwn1j4eoMKlUYwMyHxR0ISc7RB95lrMfQedNHf7gIOZAaf4DliEjsQO25t0P 3gMwrQsvyJnTIloJyf8nIid9XlruFllaLxD+BxSfEEa0brcDUFRCpuXu4cfqfQlFOfx7 U8shdf0qbJ+2rdAokdejUa+AG86LmRrkuykHFbK4kardRY1zCxQN17OKve410y/tZaDP kDu92aRo48LQgXGaf+VKzgc0yW6mS1Nx5XoasJZ2VaQO+WIzqQi21hYCGGpiNm+TfqnM XzVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LT/WNNYL; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si12597573pgq.28.2018.03.08.00.04.04; Thu, 08 Mar 2018 00:04:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LT/WNNYL; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965446AbeCHICN (ORCPT + 2 others); Thu, 8 Mar 2018 03:02:13 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39598 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965298AbeCHICG (ORCPT ); Thu, 8 Mar 2018 03:02:06 -0500 Received: by mail-wr0-f196.google.com with SMTP id w77so4670754wrc.6 for ; Thu, 08 Mar 2018 00:02:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bfSGqmiQjjK1wgLQG8o9oc0lbvhcCoXxBgjjKuFI7yc=; b=LT/WNNYL9zqtovW+Kpl/sZGZIstlQaN3ReLl38itTPiX1txro58L6+TibF5TPRXAWf RrR32ROowziGwNDdmZ3iLeyxNpj1l26lnwAbMxU455Svr9jlAs4PTiT57xsrHUdI8kTC qPkgfrUBzvkb3esGcMnRgbko0e97E0ihc70Mk= 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:in-reply-to :references; bh=bfSGqmiQjjK1wgLQG8o9oc0lbvhcCoXxBgjjKuFI7yc=; b=cBsvVj6pMW4b/qrTB6gyIbh/gyAdlGbFhv8uka1aeWMldxQJ/gK8RUjbdnqpR0g20T qJ6rHY1l7iRL0lcKEkbIzUcD5jcI3rAjaSd+MnfDPX7VvoCq6vWW7by8303cKXSKXpEn 0YStI3RPV1M4aTfzJ1jJo90oZZMDSzO7+Vk4OjC/Xu0ZmHZvuJO35ZTC+03W5GJ5P+i3 cytj2a1WWgqptlOGEIXZziMs7rhHHARrN00C+OHtn9yag+wTQDNEFW048VbrWC2BIspZ NJbJtMg1XVkEeMkKVum7UE9ZHjDCon6H23wuBAX9YPVko1AmFmG9Z2tftUtAO1Jk4UmM S/4w== X-Gm-Message-State: APf1xPDN+uTrD6ZO/ee/6Y2WeOs9CZb18YBMcdh3cVFDddbYK0VNI2y+ /Rv5UsferGp2/mYs1pvEBBryezBm17E= X-Received: by 10.223.195.147 with SMTP id p19mr22742403wrf.224.1520496125031; Thu, 08 Mar 2018 00:02:05 -0800 (PST) Received: from localhost.localdomain ([160.89.73.46]) by smtp.gmail.com with ESMTPSA id e191sm11223361wmg.12.2018.03.08.00.02.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 00:02:03 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Jia-Ju Bai , Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 06/12] x86: efi: Replace GFP_ATOMIC with GFP_KERNEL in efi_query_variable_store Date: Thu, 8 Mar 2018 08:00:14 +0000 Message-Id: <20180308080020.22828-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180308080020.22828-1-ard.biesheuvel@linaro.org> References: <20180308080020.22828-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Jia-Ju Bai The function kzalloc here is not called in atomic context. If nonblocking in efi_query_variable_store is true, namely it is in atomic context, efi_query_variable_store will return before this kzalloc is called. Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai Reviewed-by: Ingo Molnar Signed-off-by: Ard Biesheuvel --- arch/x86/platform/efi/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c index 5b513ccffde4..1ef11c26f79b 100644 --- a/arch/x86/platform/efi/quirks.c +++ b/arch/x86/platform/efi/quirks.c @@ -177,7 +177,7 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size, * that by attempting to use more space than is available. */ unsigned long dummy_size = remaining_size + 1024; - void *dummy = kzalloc(dummy_size, GFP_ATOMIC); + void *dummy = kzalloc(dummy_size, GFP_KERNEL); if (!dummy) return EFI_OUT_OF_RESOURCES;