Received: by 10.223.185.116 with SMTP id b49csp6025235wrg; Thu, 8 Mar 2018 00:05:59 -0800 (PST) X-Google-Smtp-Source: AG47ELtJLstIohykm7GsyQ8h9JtA8YG8ifumZta3hdG//mQObGvLjk/Xr0N3bcCV/+eQ3gKLyoUp X-Received: by 2002:a17:902:424:: with SMTP id 33-v6mr23576495ple.433.1520496359782; Thu, 08 Mar 2018 00:05:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520496359; cv=none; d=google.com; s=arc-20160816; b=zzf8MVa66Xr3diw6r1DH0xhi6yRHQSbdCmq42CX3dJ+XBdSgqcTVJf6rC9TRa9q0F4 jnl3NnKvi6a5wnLGou7sVMutK2LWiToWK50LMlvejCIjgYzoYTiV3OQcozAZUgkeYBf8 OJJ2m35YzjltC3LhSnNPqq/po2c4tSNmX6A3STSBLsziM1X9wlwjhg0Yt2DQxvF6AliJ d7o8k44Utu45UJjhFWqgFrayggTrNqJNKkaWPqBi79tZzDpjEsaHbLvwqkZ909JLBybW 6y+lK3PscgNMqHHH1706o9nLr+FDkTZ9YOuTdQxqqzdu2jNBbBw81Gf4qzxCsk5UJ12r bftg== 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=bfSGqmiQjjK1wgLQG8o9oc0lbvhcCoXxBgjjKuFI7yc=; b=toeYTtDSCA2+/kq9SyLNgsVIaQFFo0LUSQT3/jXxWm+AqyVa06EqRTBACT0+7QVBZV IqvBepuzsBW2czczXC9m0rUmpUNMqsGow8lBOAI5PwvzpUJVUUJZ3NoesQ2Rsv70V1Sn 8QGdJBT9tRWrs9oSllWnfbyftx6mDKAVfjbLPy9zUInmZ5aIJHmnL+C+Cb3pFrlza2kG ovvyXzy+tUxoV9cavhMemSarxcGZ871tb03lA3kkc1xOxRL36Mcy0i6G01LKuPc1yonP RLN1/cG5AfGDeRY5yNIxeL6/YmMwbU2KbPDMEfKdaiJ8hdWlodJs4sUrfvl5W+cpdORq Fw7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LT/WNNYL; 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=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 e5si15461592pfl.5.2018.03.08.00.05.45; Thu, 08 Mar 2018 00:05:59 -0800 (PST) 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=@linaro.org header.s=google header.b=LT/WNNYL; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965928AbeCHIEN (ORCPT + 99 others); Thu, 8 Mar 2018 03:04:13 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:41896 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965250AbeCHICG (ORCPT ); Thu, 8 Mar 2018 03:02:06 -0500 Received: by mail-wr0-f195.google.com with SMTP id f14so4668640wre.8 for ; Thu, 08 Mar 2018 00:02:05 -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=SRg+5g/d5Bbvb/YwDTSNooYN6IYWLFyp5nQx4wj9URsrwVaj4ZIY7IHfhL31rxG4Mm ZN6+sQmMZobxC3IT1gxZvGArTUigVr2ESa6eISjRb0rk6SRh1LmtZeNvOclkF+pJMN2h clHDPta0hwGQDkXojw7AXSSA9WPRID4EaL+PEAv9DycsAUTnK3FxxGjbFYmqV7QbB695 EK6dri56eTXVFSgk1J2agpczQwxLCGICCyO/6BUVB5ZiErGTIMZqgoT0jv27oSRCDW3r ALkrJ5cXY1NNxOdsO/de7GiOmHMQwtdYuuscJSYHrQHovqQsOz5Zlbgb9y15DGk0y/9U ELnA== X-Gm-Message-State: APf1xPDiibu3CjvnPfLZRtBgneNA57H5OWdo1/Yck8kEvPtWb4VQroMN T5Z66FC5mS4nmle+wW69+Ziv2Q== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.15.1