Received: by 10.223.176.46 with SMTP id f43csp504465wra; Fri, 26 Jan 2018 02:22:04 -0800 (PST) X-Google-Smtp-Source: AH8x224vt4in7WptHYLQxU/u6sbJ4wl5s9zF3DgqfXCs4Ly9CNwMsrOd+I5E8+rjgdsnL8s4OIlb X-Received: by 2002:a17:902:5814:: with SMTP id m20-v6mr4668409pli.434.1516962124754; Fri, 26 Jan 2018 02:22:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516962124; cv=none; d=google.com; s=arc-20160816; b=nVHhgVM+xjRgJKckJCiDSxuvCdLfKQjT/FHEmIHN7A7uqUNy9wqvHW4f59HzMQZZy1 Fc74gJ0S49m+bH5HbCo4TPNUlorCYH07LEidPz3L3+Fmok5gAGmk7ALpjcxirbJGMQ0D joHpzEba/maJvQlRfuAax1QzTGe/V3f3UzdtZqPG+gcWSlsZhRPkJ5PqBtvYE8BiOh7O hURI7i3O0XiKMjeNE8DmZm+LAiFf8HVsV2eaKan2sKl1jv5WL1DM7UOng5zPSXJn+iS4 3xWyMehwx3Xt7dhUBGvKAA1Jvez300ZHkI9IG0ox+eiNkI15fm4qRoOtIKnnML4PYAPz PPSQ== 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=KoO3f6AMq0dDF9QrssUqmpRZQy1DdaYtJfbPeC0rbq4=; b=VfLUnTwLFnGkuHJ5UecVyHADAY+CqOawFaWVaiQPOlP5kXAYlkn+yqa76oEUkBeMos ++GXGWFPbQLHscnKUkJ/bMZ3wGzOoJsS5pkqBxDzLmBVSl6PymueFkLWM6t9NX8SkuVg UAEXT/q10Vf1QpyXnyPkOOG73eMfPxq5dG+Bf5+q89g6zYgBK/Szimr3Gsp4dyaCVPyf 3KPBm6tuYyIVq33AAAUJgAj3j31iS155k/FoJjDEsgDiqPIHk2PAafyQfYGQnAlCUwsu YR71WzLOavvs4PpWWx09K8/e9ka5olepad0FrxzLdWQ4j8PDV4HgXwIYLnq7wvPlVAo5 iu0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IlRp2u9t; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6si2820375pgd.282.2018.01.26.02.21.50; Fri, 26 Jan 2018 02:22:04 -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=@gmail.com header.s=20161025 header.b=IlRp2u9t; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753093AbeAZKVR (ORCPT + 99 others); Fri, 26 Jan 2018 05:21:17 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:37246 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752409AbeAZKVP (ORCPT ); Fri, 26 Jan 2018 05:21:15 -0500 Received: by mail-pg0-f65.google.com with SMTP id z17so17778pgc.4 for ; Fri, 26 Jan 2018 02:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=KoO3f6AMq0dDF9QrssUqmpRZQy1DdaYtJfbPeC0rbq4=; b=IlRp2u9tPbfm7N/YeGIkvKIpYv/OxTcqwU3+OjG0s3XlvVBXBXnfZGuZwuawIELBWo AzdnzJYWwcGZFGyF6PHk3WYAp/mioaPSpbm4D2LduFcId6IkTVSVWSHZ800lDmeo8DU8 xMru6svGs7e7CnuF+B/IPXNPYdUank0P2b+c21wVXqb/POucT7gFudOfAoqlZfyF+OvJ ON3hLdd/ObsoLQNqtpWeX811boMCv8j/p80D3D7mJ1MtMG9zak4mPlCWask0QQ40CaIw SCvCLj1rIyGmrpPCyOa2dz1U31Zk6+AKX7l9HuPSLTCivfPJD8JVGFTwLEtipVyvbSDT aZlg== 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=KoO3f6AMq0dDF9QrssUqmpRZQy1DdaYtJfbPeC0rbq4=; b=M6UXVWnOTME9PPyqsebeK3eRJlhBZ6UvkgMdM5jxqdgJ0DGbwH0na2rLV5/2dtn6+a Mv9nVDhwz4I0sfqTAF/SPKRmuLKGpif86vy3LtBusy0ICcZghGy/quLUKaOQeYE1dVbO pR2ZROcA8YXZkPLCAW2hVnI3TlxnblVMyEB0tY9rdPYPr0y73bKeJYnxO53XPKOB3zjq e9fBIzsKHP6sJ02DzDLn5oLocSA+A9JCSWYDvCAdjiW5V5pTMANnBW+dvcisQtYCq9/8 ZPQmxrT2K9LoFN1b1nn+GxjKx5+XrxXZNHaHNo19qP/XTJHAIb0jbap5lxG2qJFl1PlL 8Mng== X-Gm-Message-State: AKwxytf5GhS2oE/Aq/msS0Sb1VmP+ey2XJ6XVwk22JnbgDJ9aHNE9/gm E0DgIry9nHn9xZX4B7x+1GwzZw== X-Received: by 10.98.150.213 with SMTP id s82mr18982759pfk.10.1516962075294; Fri, 26 Jan 2018 02:21:15 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id v81sm19869403pfi.65.2018.01.26.02.21.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 02:21:14 -0800 (PST) From: Jia-Ju Bai To: keescook@chromium.org, axboe@kernel.dk, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/2] block: DAC960: Replace GFP_ATOMIC with GFP_KERNEL in DAC960_CreateAuxiliaryStructures Date: Fri, 26 Jan 2018 18:25:50 +0800 Message-Id: <1516962350-2246-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After checking all possible call chains to DAC960_CreateAuxiliaryStructures(), my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And DAC960_CreateAuxiliaryStructures() calls pci_pool_create() and pci_pool_destroy() that can sleep, so it indicates that DAC960_CreateAuxiliaryStructures() can call functions which may sleep. 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 --- drivers/block/DAC960.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 442e777..39fc016 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c @@ -323,7 +323,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) CommandsRemaining = CommandAllocationGroupSize; CommandGroupByteCount = CommandsRemaining * CommandAllocationLength; - AllocationPointer = kzalloc(CommandGroupByteCount, GFP_ATOMIC); + AllocationPointer = kzalloc(CommandGroupByteCount, GFP_KERNEL); if (AllocationPointer == NULL) return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION"); @@ -335,13 +335,13 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller) Command->Next = Controller->FreeCommands; Controller->FreeCommands = Command; Controller->Commands[CommandIdentifier-1] = Command; - ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_ATOMIC, + ScatterGatherCPU = pci_pool_alloc(ScatterGatherPool, GFP_KERNEL, &ScatterGatherDMA); if (ScatterGatherCPU == NULL) return DAC960_Failure(Controller, "AUXILIARY STRUCTURE CREATION"); if (RequestSensePool != NULL) { - RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_ATOMIC, + RequestSenseCPU = pci_pool_alloc(RequestSensePool, GFP_KERNEL, &RequestSenseDMA); if (RequestSenseCPU == NULL) { pci_pool_free(ScatterGatherPool, ScatterGatherCPU, -- 1.7.9.5