Received: by 10.223.176.46 with SMTP id f43csp396343wra; Fri, 26 Jan 2018 00:19:38 -0800 (PST) X-Google-Smtp-Source: AH8x225V/mgAzErFjEDNdaSwCKPtIuD3z1XtjRB0/2/eEJLRTyaD1Llw+zB8AdNavrBPISI9d1/c X-Received: by 2002:a17:902:b43:: with SMTP id 61-v6mr13942346plq.127.1516954778446; Fri, 26 Jan 2018 00:19:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516954778; cv=none; d=google.com; s=arc-20160816; b=lC5oSQzM0UlkusBOqShgAu7B8dNY4rvhPvFcg507qxuK3CP7Ioi57U1fWjhieGuWtl SjkFtiX2WW6RRp/DqCPbIu8FobYjkIfoSn9/rPdtHtL8RhHS6wtb8BG2I3B/2SZnqRNL v35cmebBHSOvFJc4stzjGzpRb0y1OVJJbr6opwFX3Kc/zCA2s8MIOKHhthIggGlG86LP /jj8rpYUhkl+T7OmVL9MSDXfmK2UhyFh8R4rIhHV5z2f3pZYHm+8gkrrFOB/5S42w42G 7vZzdX/2AcBHL1pNHRp6JhM1ziPuCeGpoDUOQx6LmsiOIDIFRfApfFDxbSBsHqio+31M GMhg== 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=ApfiMIuEEEwSbercgbmxcDFJUMTKCzC/dViIRvcPmm4=; b=dvsVCOI/qmKoqeMX1BU3Zbt8WtVZ5Kh9pCpipZMG7ljj2TFW2++nZ9eYIWtBMogmFI 0SGWLJyL4i1xAhsFPJoNnfsYk+Oii6JpZ33GeB6dTHwg2Qxsqvyfv+ic9KH3jihcqNHS CDAGANSG0DWH3THzlaIc4+TFYxKKE18fb3TMbHH2WaSUI6mH4mSgUajm8IWNkIsfg9AI 3V9qwh4BNdEOUN+xByuNi0Hcq+XVnSVASP/STEseQMZdg4Jltaq3k0qYNQLej8U/D9Gr SqqKeVX15edsli1Na9oCOGJbWza1xdK3rFg2+fKLr413D9eaHh+kvWAzlY26QoDVqSej a6Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B9t8Jg8z; 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 k187si2691101pge.377.2018.01.26.00.19.22; Fri, 26 Jan 2018 00:19:38 -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=B9t8Jg8z; 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 S1752220AbeAZIS6 (ORCPT + 99 others); Fri, 26 Jan 2018 03:18:58 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33833 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615AbeAZIS5 (ORCPT ); Fri, 26 Jan 2018 03:18:57 -0500 Received: by mail-pg0-f66.google.com with SMTP id r19so6827638pgn.1; Fri, 26 Jan 2018 00:18:56 -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=ApfiMIuEEEwSbercgbmxcDFJUMTKCzC/dViIRvcPmm4=; b=B9t8Jg8z3LzESAEVExmYprXs7NxtZVwb0iJRCECOK3uFwGhiTkAHLN2+O/722Vx1uh RaSMJCKGyTzx0Ru/CP2V8OV3P2YKXFo/4c9nx6oOhr4C7m2UT8cxMITzjDE8DRwvdjpn xkvF0oCJpq0PumoXPWGAliSnCfHjljmwjIfUyb3pm5VPkQTDxFig9Vy5yYuBRumV26ZL 8sXyfdjo3dQgWsXa2bZ/4CDIdckiL9LWmph8zMuZHS3qTLP3PJ425U/ZWOGw0DND4Oqf v4a+2rJFYSQWgPbL0XMvU9puT2FmP827hymBRQo/+dPkgnSBGH/DkgSKgEKGzZWIeUan y6mA== 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=ApfiMIuEEEwSbercgbmxcDFJUMTKCzC/dViIRvcPmm4=; b=t1YOpcx6lgUrzwOqK+aEJcRQDp3pL4d9aLh6iZ8IIbueeBubvhgd5/SKSnrs7grsdj 3xWOrdafVuadTYyq7Ome/6uHrmxQL67gt+MtRw2RQQ/41zM7Fa5qTwyyPpOgDdQkxiNp glXmNMZAfBuEjl1IZPgFqBGXZc9BoEpcxupOl9hI8iX8tTdcoXv552prl59fgdmYDwRD G5+0bvRl4e32Cds18yzdb0EM6mYfuTebOVFxThr7Oq0XgM/R3vI1pk+/Sdg6xM5FJkj7 0lYZ/qk/HrBfUTGsaQBAJlEkKZQEGQY0lBa4CAJ4wUa1Zk+eM20LASTtNYq7ntItMpPj QDpg== X-Gm-Message-State: AKwxytc1OOKUjHPK9z4ekRkhaGC91fBVTe3/8gXwMudc/UnocpoF8JQ/ 7UJrr5Yyxiu1IlKCxy382HA= X-Received: by 10.101.80.69 with SMTP id k5mr4225599pgo.449.1516954736541; Fri, 26 Jan 2018 00:18:56 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id j125sm7096455pgc.29.2018.01.26.00.18.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 00:18:56 -0800 (PST) From: Jia-Ju Bai To: 3chas3@gmail.com Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] atm: he: Replace GFP_ATOMIC with GFP_KERNEL in he_open Date: Fri, 26 Jan 2018 16:23:30 +0800 Message-Id: <1516955010-31452-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 he_open() here, my tool finds that he_open() is never called in atomic context. And this function is assigned to a function pointer "dev->ops->open", which is only called by __vcc_connect() (net/atm/common.c) through dev->ops->send(), and __vcc_connect() is only called by vcc_connect(), which calls mutex_lock(), so it indicates that he_open() 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/atm/he.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/he.c b/drivers/atm/he.c index e58538c..fea5bf0 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c @@ -2135,7 +2135,7 @@ static int he_start(struct atm_dev *dev) cid = he_mkcid(he_dev, vpi, vci); - he_vcc = kmalloc(sizeof(struct he_vcc), GFP_ATOMIC); + he_vcc = kmalloc(sizeof(struct he_vcc), GFP_KERNEL); if (he_vcc == NULL) { hprintk("unable to allocate he_vcc during open\n"); return -ENOMEM; -- 1.7.9.5