Received: by 10.213.65.68 with SMTP id h4csp2728206imn; Mon, 9 Apr 2018 08:07:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/o1BVYXwVStWvvFRF6FmZtpLz6LIN6yGe4qKpWmUKcqJFUubdBjaqnfTMupmIFHWQpk96S X-Received: by 10.99.173.7 with SMTP id g7mr25174921pgf.170.1523286453989; Mon, 09 Apr 2018 08:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523286453; cv=none; d=google.com; s=arc-20160816; b=wMHAa+8I7oSvrtQes/NAU4heG493+dQVopI4qqP5wv8KZLz+iGQ3W10+MEcZf0iHZi RsISUuhFJMPY4AmpOKeEKNr91rXkixMJ7nfpuQs3xTJ2OngNevayTwetCrArqTfz1qFJ mG8QxrUEqzxnZFeAvzkCtkHaMrS7oTWKosiPtWt3XT8WXKdGRgk42ltpLb3vFjYNaZtg ndYTY2AdWdQuEg4mCkRB2VzcoTvLusdq0Ma2+tMQsci/RkXIhM7JRl8OZB2WUfjbpV3A Qsy1ECjHfDp5cppSuR69Z4lwMZxItwX//DSgJmEwzQ2i9+IDbj3/vohLBO1GOJ9STWns injQ== 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=ZXYPyUPFYwhXJy/Xb/U+NjeloED+l0xg9qUfo0SfosE=; b=sK0FY395dBVi4pC6VYsnqpr+bcQNBv2K3cT6rXtWR065xrnZ9InUO6AIzvez0Sn7bR Px1rVMcbk5cTul4OS3lt3C2sTGsTzi2Dd5CiZ9rcS92catU2VR/jZrAswa0CxDPa/pD8 jGaaooo3cLfs2ZZMh6NWIhZY97JH0LznCdcWZu00O/CUJ98Y3HqHbJbD4sNTFN/Jnoeo +fnv5+CMjLM89hsKKkHf2++tq2GDYf3FWn+3sCENqKfT2s5VsfFrZWi9kTKJfI+uVCKR AwmWjjWuPuehBeCL1FmfT3XTW28lp20Awcghe3d/Cqu7WWuIlhhRNVHe+TZwttSRcZdk uo7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GStMIGOr; 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 p6si367428pfk.357.2018.04.09.08.06.56; Mon, 09 Apr 2018 08:07:33 -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=GStMIGOr; 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 S1752970AbeDIPDs (ORCPT + 99 others); Mon, 9 Apr 2018 11:03:48 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:39383 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751662AbeDIPDr (ORCPT ); Mon, 9 Apr 2018 11:03:47 -0400 Received: by mail-pf0-f196.google.com with SMTP id c78so5885744pfj.6 for ; Mon, 09 Apr 2018 08:03:47 -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=ZXYPyUPFYwhXJy/Xb/U+NjeloED+l0xg9qUfo0SfosE=; b=GStMIGOrNnAU5yIg0NSQptDgCR6zHAN2iyghUtUWzwwQCTdgJHjLv1E/fiaMaxICm9 ZR9wwN2uMXHKudjrGML41txbtqYEpV7Ch+9fke7WHTQ6zkw03dTu6Np6tfvC+DzLSZLg 1Hql6Zt1fBE2DbGj1W/IiYsnswY3jHy3VoP6oHQAL706wrb9sb0ndMJN7V6ec5OrFxon ePNVr4+NMfL9Nl6lQ9GnCbLPXgIn9ifUzn7aG3lgSIYu5mJDwI3LZiM9h+jR81MAwAxN Vo//k+tO1JWtAjCF6hDqxTganAOjk/ByqtPN2KbEFY0sWry7kuHTVzyla0i/Rb8WwjNm ji1g== 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=ZXYPyUPFYwhXJy/Xb/U+NjeloED+l0xg9qUfo0SfosE=; b=ulO+i0PNOFp/djYhbehoHDLWkwMtNF51sFW6Xc47KKMWmcmGOg/2834BycJ4paYyZM f6WQanF1asdml01Gt9A0EkZocyQ0BSxKcl/eJikIka3fHUU8CVZC6tzUyhdiEVrer+ca xli9t5lprtUWk3HrggCRarvCYoZr+VHpNiO4BQPrOgpNT8eKyw5uTOQUNrBldQYaRph3 /5SXw/baSyOBpWYtEuOnAGiFOFvJ9hcdryWuC6uQVId9YxfukPNOQw1QHnKMAkI/hZ3U 3F82u5Ed6shV5XfU7QgqvBTUXo/toW380kLUkPolu2idzn/Wh4bJKMnppmvl6juHHFqf MFbQ== X-Gm-Message-State: AElRT7H+pDjZrXsR8Zk9pdAme19KF4MsrBSqcQQcEuaAp1+HVMh5/fnO butqaQGZwvzrKd+DpxF5nPc= X-Received: by 10.101.69.133 with SMTP id o5mr25231443pgq.156.1523286227005; Mon, 09 Apr 2018 08:03:47 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:39e9:70fb:21a6:f4d2]) by smtp.gmail.com with ESMTPSA id c3sm1521641pfd.28.2018.04.09.08.03.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Apr 2018 08:03:46 -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 1/4] xen: xen-pciback: Replace GFP_ATOMIC with GFP_KERNEL in pcistub_probe Date: Mon, 9 Apr 2018 23:03:36 +0800 Message-Id: <1523286216-26345-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_probe() is never called in atomic context. This function is only set as ".probe" in struct pci_driver. Despite never getting called from atomic context, pcistub_probe() calls kmalloc() 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..95e6ddd 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c @@ -577,7 +577,7 @@ static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id) } if (!match) { - pci_dev_id = kmalloc(sizeof(*pci_dev_id), GFP_ATOMIC); + pci_dev_id = kmalloc(sizeof(*pci_dev_id), GFP_KERNEL); if (!pci_dev_id) { err = -ENOMEM; goto out; -- 1.9.1