Received: by 10.223.176.46 with SMTP id f43csp1526476wra; Wed, 24 Jan 2018 18:50:02 -0800 (PST) X-Google-Smtp-Source: AH8x227JSEPkOCXqe5uffmMhnL/8I/vBiBavcj/H6i3qipXfGegGd97m1YtMIntl66y1xYB+O9zw X-Received: by 2002:a17:902:ba8b:: with SMTP id k11-v6mr505722pls.232.1516848602603; Wed, 24 Jan 2018 18:50:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516848602; cv=none; d=google.com; s=arc-20160816; b=I94G1HKF/BIZv8qOkxe6z1oRREx6YsiGLKqgSqjKVqpTkZbTWT+XYB2o+JpQroFury BE0DCgM8DhyQ+U0365c58eazdl8cQsb2uu48dVfEIbgzX98IatV1xHTXDoPlpJLGxFc1 JxB3aN5/TgxtCGc7Gd4RludpjJMmYDr7TN+FoSEXydcL2JaU4JbOliOH5x+PaqGIIQLm XFuNmTVu7ca2y7Y0QUd5YoDD+m9uVf5LD+hxXIVZ9jfhYspkNKiHz/GMYtPDleR9nJoJ r8tENX2q4dK5gdudN7WDvOosHDO3fxqfQ0z/VOYQmUxI+IwHdJWsfsi5NVZ5Yg9OfB8l Uddw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=nxB00iL0k+Y9XUOm7p+1q2XaQjUCr4Nkb+qnw5qBUg0=; b=RdQNwD8b1Ldz1iyIfEWjE6DqECvxAPzI7hneDBT+AGAa8/8v6BQiVO8sFJh08P/EHq PMv1hBygt5qDCN/jF6Xt+OiCwBLyVCSTvg0ZwKA8f/an83ZxLOxL8nNW7lcSoNG/2nAw 1pj8Egs+GRjV9aH/Cak2kVeQa7jLs0bG1ViWGca7yfaYQn5H3N3Dy24nv2w6ci5l7XPD yZkiNP4Jbm67zXjRyX1guGb+JdNn63km8b/0pZP/OtVuxGjs9zQA88YYthblPgQAuzSB UoVZyXPr14HbY9XhZoDv3HvGTrKI5/RN9cL6SCldDajw44o8kcMGCZRC0vXDJ9XYKRt0 W/Fg== 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 o7si942690pgf.315.2018.01.24.18.49.48; Wed, 24 Jan 2018 18:50:02 -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; 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 S933235AbeAYCt2 (ORCPT + 99 others); Wed, 24 Jan 2018 21:49:28 -0500 Received: from smtprelay0083.hostedemail.com ([216.40.44.83]:41220 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932698AbeAYCt1 (ORCPT ); Wed, 24 Jan 2018 21:49:27 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id EA208180A68A4; Thu, 25 Jan 2018 02:49:26 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3870:3871:3872:3874:4250:4321:5007:6117:7903:8603:10004:10400:10848:11026:11232:11657:11658:11914:12043:12048:12114:12296:12438:12740:12760:12895:13069:13255:13311:13357:13439:14659:14721:14819:21080:21433:21627:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: heat90_5249ead9aa809 X-Filterd-Recvd-Size: 1947 Received: from XPS-9350 (unknown [47.151.150.235]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Thu, 25 Jan 2018 02:49:25 +0000 (UTC) Message-ID: <1516848563.8378.60.camel@perches.com> Subject: Re: [PATCH] x86: efi: Replace GFP_ATOMIC with GFP_KERNEL in efi_query_variable_store From: Joe Perches To: Jia-Ju Bai , matt@codeblueprint.co.uk, ard.biesheuvel@linaro.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Cc: x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 24 Jan 2018 18:49:23 -0800 In-Reply-To: <1516847386-5291-1-git-send-email-baijiaju1990@gmail.com> References: <1516847386-5291-1-git-send-email-baijiaju1990@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-01-25 at 10:29 +0800, Jia-Ju Bai wrote: > 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. [] > diff --git 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); trivially, kzalloc takes a size_t not an unsigned long and this _could_, though probably doesn't, lose precision. It might be nicer to convert to size_t where appropriate.