Received: by 10.213.65.68 with SMTP id h4csp3845854imn; Tue, 10 Apr 2018 05:41:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx48nSJgonayDKuM7UTeI4ud+s0gsBTrU2meqKIf8Y7RLpPbUFoBUsdq848BA9VUlqqmxOeFD X-Received: by 2002:a17:902:581e:: with SMTP id m30-v6mr272222pli.406.1523364094364; Tue, 10 Apr 2018 05:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523364094; cv=none; d=google.com; s=arc-20160816; b=A/4ed1bayNyRpUzwX0tpVYOBBjMjTjb8+sVyhKJrP0gG+SqBKEPh8P7VBS+BJneRc3 baKS3IZsiYGvdUjVKtinJSbGJ2pDidFOiWwMm2YezHTjLqTAgGjkN1n/E5cTIcC74i9H UDyh1/8zAWIyPWjNPUxvVPVRIqGMhN3FTBnb7QNH46jYqBScUbHYUACAwsaTbCcY+fgO e8/hcZNgPMtbpjnwqkkOelB6qdyoZ33tJ3Ejfevq0brnSKKfgc9qkYooqqjlhQWi2bst eUZmV1wJccIl0Q0TO6fQgdS1KjRihPDb0JRnVTEtvw5hoVhXbVEe9n54l7cU1Oh5ig2M u4HA== 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=Wq/1TGZ00nPBqHhB7NdeqSizRIjB8GzsuRhg26TOWOE=; b=Xbj0OueLOKju2QolxTvxgFAz6wqZKNcGN2cyBDqvcKfXK3er7B76d1oXZ0TxS7gWsW QAjjdWVd1TRCWcklIYzgDJo+ZDedH4hI7z3QxPpKWo0dHUXBeWQlgdnn9DZG5W0MD7Kb dg3lxt6BIq0NG0Bqg3SltrqyswbxCdfnjFhEHnJCCBnONM1HSAkZksoQ9yoHil4OUK31 10SL64bShuoybYUcgpZSw17K27LyQmytCamB1VB9Ch4pVvBP+NxcoxDnPfeqEt8b/ffC FDxZSOOrO1838wenGcESh4e2mmv0oJLmZnI1moUOw8+am0FD5fHSAYx0ujwdIovLlStv QnvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G8raC8Wa; 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 m12si1766465pgd.240.2018.04.10.05.40.57; Tue, 10 Apr 2018 05:41:34 -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=G8raC8Wa; 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 S1752754AbeDJMiW (ORCPT + 99 others); Tue, 10 Apr 2018 08:38:22 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:41310 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbeDJMiS (ORCPT ); Tue, 10 Apr 2018 08:38:18 -0400 Received: by mail-pf0-f194.google.com with SMTP id a2so8188328pff.8; Tue, 10 Apr 2018 05:38:18 -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=Wq/1TGZ00nPBqHhB7NdeqSizRIjB8GzsuRhg26TOWOE=; b=G8raC8Wa7LNsLyLEfY5yyLaRJMPp4YnYQhjjK05fFgScaYW6dg/i33YtcMO1mVVe7e 0JYzlBvxY0eb/uiUaeNzkJT+PiEm12fpJherTbYkGHUfjSx654kG5yyGAQZ8OOkzRLqQ w9Z+pPT7keIxrzIvv85OVn7939uT3cAAa0nsk/JWZYUzz9BzDWOn0rTfmN1hYd/EGg0f YBEryTWLAnL0dmlwUg0vWXuC/DwegQqkslpbnp1Pz/KvM2GC16uL0BmVsI4YS5P9rZjV LFYfagR89X2f4SCxPZCtdXD1gYufxHFlQFb3vba56jKz7DwLwY8UZA3YBnA+u46Xvp4N dNvg== 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=Wq/1TGZ00nPBqHhB7NdeqSizRIjB8GzsuRhg26TOWOE=; b=s3B+pmDkmMMZ0wK0/LktYu7X7pg9J3e+h81/9z59GIIdQ3IeN7aUd1fJUTCevXC16f fGaTVzIZ2H0xLqw8HTaY8PsP24ghYs73osi6ThMXoeElYocgeXBL3yrbfsLScIPiDXzb aC52KWFG6AY5xtnKcyUuQsRwb9Cg6PPGgCaFpAsMSLA2jCwig+EbeeJXp83eBLd+kI/k pO+pMvkpXAX1M1IWac2nEBiO+Gj6UU0iscVNc8Ma+rmdfa14egWhBT+/pao/UNQrFOq8 iiUyQuuDCOx/N43BFxtwFwmXIjjlEvoh+st0z85xLKP60n/OgWIOFEg5MEcsk1TWgGnc +SqA== X-Gm-Message-State: ALQs6tCYOuD/b1MKx7KJI0fUQ/55KZWrr6grqMtEgOHb0cbl9cmFB/Lo ixNSz4+0DR7+YgQwwoGQrw8= X-Received: by 10.101.69.198 with SMTP id m6mr186178pgr.244.1523363897906; Tue, 10 Apr 2018 05:38:17 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id g10sm6092149pgr.69.2018.04.10.05.38.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:38:17 -0700 (PDT) From: Jia-Ju Bai To: Kai.Makisara@kolumbus.fi, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/2] scsi: st: Replace GFP_ATOMIC with GFP_KERNEL in st_probe Date: Tue, 10 Apr 2018 20:37:59 +0800 Message-Id: <1523363879-31242-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 st_probe() is never called in atomic context. st_probe() is only set as ".probe" in struct scsi_driver. Despite never getting called from atomic context, st_probe() 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/scsi/st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 94e402e..1da42f3 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -4290,7 +4290,7 @@ static int st_probe(struct device *dev) goto out_buffer_free; } - tpnt = kzalloc(sizeof(struct scsi_tape), GFP_ATOMIC); + tpnt = kzalloc(sizeof(struct scsi_tape), GFP_KERNEL); if (tpnt == NULL) { sdev_printk(KERN_ERR, SDp, "st: Can't allocate device descriptor.\n"); -- 1.9.1