Received: by 10.192.165.156 with SMTP id m28csp143277imm; Tue, 10 Apr 2018 18:24:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx48zswAwhOVb6weR5ztSnMpsdY+GWLVUyHpkfPXnBI3nZ8sTiSL8uFT9qZ87fe24rRyPDP1u X-Received: by 2002:a17:902:6acc:: with SMTP id i12-v6mr2796177plt.353.1523409860876; Tue, 10 Apr 2018 18:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523409860; cv=none; d=google.com; s=arc-20160816; b=s/NrIyohb0qQkR3TimwhiwAjRb5l067qrAwQrQlQuyJMIntWLMwQrusKCduMWCnMAN WEld+YS+Edap6YL7DYsQCGxX4mgHQhOUVHIT2cyRbGLI17koZRYyGLoOmBohsxR9LLKM 0Npx0XefltDXnVX1cLn4xG+vsZEpuOmdGoR6o8P/ZNa7YQt8m9rnbTAG+nk2f5ubPxo1 aO93gpxDm98/vwjXR6gXvfaev4mh2oXwH0cOYGfoCVWnbJBe9tOdMZz4P5FfIafBKlDO Q2VoWh/PBXdwDngOt3H+4DuNvZxmbXCJznxkNGUD9qqnYbLY+QBx4qr1nPlZlVlbV7XX Cdfg== 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=ERITuvzwk45WMY0fHpHNUyZDbx3YfmdOyHSDK/C3ATc=; b=vFha4wUUCrdBeXB7R6mbbsDA46GSqGGdPAthXhzUU5ah7ukk4tGDzPLm0B8/8CrG6T 20LsqvaHvzLsfVwqwzpIBMzeyjZTxV/3tEJ27otEoaioGusAPHudRBcPNI8Qa6Bv86Qk 8mIVPZ2dZ5JL4c2U7GXkBEcRhLpuAY7zSL5OpeGQW1aoB6o4/c7Gqs6DuJC4D1Kl6Txa 27v7+0QYs5NHauXtfYk6dF3uQJDUuRuYkYPa2a4ZlEKDJn7KaRLOJFV0Q14EHXBJDQjR ec+6QQlQuhqxrXsHgJVGrL5GmMJ7dsWJC+fqpQ1FGa7G8qhkBoMOqekUwDXQfVYv6Unt 6z+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MalOCdBY; 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 z12si2567465pgc.708.2018.04.10.18.23.43; Tue, 10 Apr 2018 18:24:20 -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=MalOCdBY; 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 S1752376AbeDKBRM (ORCPT + 99 others); Tue, 10 Apr 2018 21:17:12 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33187 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752309AbeDKBRL (ORCPT ); Tue, 10 Apr 2018 21:17:11 -0400 Received: by mail-pg0-f65.google.com with SMTP id i194so27441pgd.0 for ; Tue, 10 Apr 2018 18:17:11 -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=ERITuvzwk45WMY0fHpHNUyZDbx3YfmdOyHSDK/C3ATc=; b=MalOCdBYATKcPppouO39HW1iDqZA76TJ3rBs7smqJZRS84n8ZcwmmfLzV9/GMiHCes 15ClPXISd24qHjit2RD+acskUVQaArfEEXj5FitkhK+DXd/g1cu7krK2fTDMpvsz5Sl+ ZgmQ2OlM5iMDorkA1hqdlgXMHh6TSG1N50PiW7WxvbQTXS+b7ydNKvielfAng3QI6eZE xZhgDC/vx4+jI8bpyY+ZF/DWCXdsB5laE1iC0Nb2VUpyyxrKfyj+hSFgk42yc1oD2Qzw H1jEl+kq1ZobIb4xUw7N2cVi0x3UiK646leda78Ml9QQi2+kyEcCPrebxsr36yraSl8y kfbA== 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=ERITuvzwk45WMY0fHpHNUyZDbx3YfmdOyHSDK/C3ATc=; b=I6j8ZH+NZqZh9BwyIRn4sNz5T62gwHhg1+SBmSeCIwe6z8dJmuhq55ccLn4VRwblTh TBR/rAwQl98/J5QfEhO32iH6QoMiU6CRQTe2+6TYy0rOdZWOe1pPgxUjm1Wupt8c9JQa WjeH8Meny65H5R7ioakD4kCFoIzuk+hXbopgSg2KmXmlgOED2Xs1qhv3lBkk6kpE/K+0 GghlL9dcaPtBUkw0utGTwdxHCkmEqXpDhhd9pOG/66TZ+EhkuQudDMfUpeublTd8J6dm EsWwxxLEagiJi6xnYvHQbZWwHsXMNY1nJQ5CpKgYTHBVkyP8xbJJ4f9NEVFfpNKMb7nG UtEA== X-Gm-Message-State: ALQs6tC/3IxvZArsBhXlb5JcoREM4ACo2qlvZ5XHKEXtv5A4yUTk+8Cg rr3IGx4icnIznAPmk7PX99T4Hyli X-Received: by 10.98.7.152 with SMTP id 24mr2200177pfh.94.1523409431089; Tue, 10 Apr 2018 18:17:11 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id t25sm7053376pge.88.2018.04.10.18.17.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 18:17:10 -0700 (PDT) From: Jia-Ju Bai To: boris.ostrovsky@oracle.com, jgross@suse.com, gregkh@linuxfoundation.org Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_reg_add Date: Wed, 11 Apr 2018 09:15:31 +0800 Message-Id: <1523409331-1214-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pcistub_reg_add() is never called in atomic context. pcistub_reg_add() is only called by pcistub_quirk_add, which is only set in DRIVER_ATTR(). Despite never getting called from atomic context, pcistub_reg_add() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/xen/xen-pciback/pci_stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 9e480fd..9d92bed 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c @@ -1149,7 +1149,7 @@ static int pcistub_reg_add(int domain, int bus, int slot, int func, } dev = psdev->dev; - field = kzalloc(sizeof(*field), GFP_ATOMIC); + field = kzalloc(sizeof(*field), GFP_KERNEL); if (!field) { err = -ENOMEM; goto out; -- 1.9.1