Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5364567imm; Sun, 22 Jul 2018 20:41:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfqhZE7TgJW7jMMUTjLTIPzMyVU3Uvb7LWI6CAan/2iS5LVhiJX45oisdCu2eneOxD+JQjN X-Received: by 2002:a17:902:8ecb:: with SMTP id x11-v6mr11486738plo.308.1532317296642; Sun, 22 Jul 2018 20:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532317296; cv=none; d=google.com; s=arc-20160816; b=kduJKCyONJTw7qFbpxKosreQCZ1zvBGtGcryMwfj0b2lauwR5X/PLNfH/3a387wctT GM0R2pPV4jLX62YKfc7FUpG+NCVpufRe/ZfolwtaeEptg5dfQ+aJ2PB7MrSh1TtlM7be uJkym7SpEjctVnrqmiHbw41BNmuKdvmQMpzsdubR2WbgOvTU/utIzk0Aqf+aVjSREPl+ DMJ8McfRyspQHBqdKtTTZpSkDlqXRFJwI2eagccad/EYw20dnNZU2st59pmbv2Z7N5qk Y6cX8KD8Q7t02A8j+CH1tdG5M5/MqQTFvrkt4KpXz0lDhCjRnn5Fuh2O11+EbQ6l58D8 82Hg== 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=eZiQqkTFFg41WoFSCsN8KawQ8i2v1RPfiGDsWopGuAE=; b=a2Pa11db1qa1zQU9kSeV8t6JIKSGx1f2V2LbQUDBkRPRN00uQZn1au/Be6jj04jHqt nKvMoolEMMjBRGRVhVmzfR9UofxgdOddLe/vFKVQzEGKcsUITNHdQfxPmcpnnbA1bwNB kTDH0wCBfvrut6qfZkcn9sXAsOaruumXrx0TZZEZ+bBnRkVQpmaqdWgU2B0Gz5LhMORu Cv7B4bmnhXQb3HTiAnXl4naRB124pNEKTwfOLDbjsD1os5g8E0ur8SU8Y3+uOgQx292l j51Li0Qze+i8h0Ck6rufdLPUFh3VwvYXzJLFTJyt3+c2X0cW13IdEh6OabUUZpZgSHat Q9gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fZVbtH1O; 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 s10-v6si6762603pgv.47.2018.07.22.20.40.58; Sun, 22 Jul 2018 20:41:36 -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=fZVbtH1O; 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 S2387712AbeGWEiE (ORCPT + 99 others); Mon, 23 Jul 2018 00:38:04 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:44178 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbeGWEiE (ORCPT ); Mon, 23 Jul 2018 00:38:04 -0400 Received: by mail-pl0-f68.google.com with SMTP id m16-v6so7634807pls.11; Sun, 22 Jul 2018 20:38:58 -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=eZiQqkTFFg41WoFSCsN8KawQ8i2v1RPfiGDsWopGuAE=; b=fZVbtH1O55IKbQJVTgn29DYK/BY5fxpfvrh2BThf4o1RzJWZuFDdWCWWMjdvLngr1I jSEDPT4/DjdBYdMLuNesjqQq+7AwvmN7NXLJOgppRXxvbFjj1krW1GYgAJTtu9ebyAmZ fRgGbDX8k41Fbg2BA472IsqTdwpljov/cc5X7N9OiHM/DqXAXzrMOULdfIUtIQ3xr1RK UxwO608+7gTJPMEDlbTe7gwDigvywwVVJ8MdD5aSTVqZQd98WfvsF4NMqQPMxtyKAe1b LeBQQLXdwU/oS4pchOAo1NY36TBd1vkLyXWCWAy0NKxTfs4sEDmJd6fA7VUI+QNvo6LN /OKw== 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=eZiQqkTFFg41WoFSCsN8KawQ8i2v1RPfiGDsWopGuAE=; b=Y6mM61xRNoVxvs3s6Bz8F1UXsL0I0C3ASK3ZIMEvDsrs7kN9nGoTWMz7pBRN3gYBbk wffQ5HUHEcE7hORoPguYFxbvMeftiv1DLtdDo8WCgumFv8wdWy9Lv8wkseACAl6+amqF v46GNMTWz/Ly3orBcFZQ8MxHpCo38cumhhIpfTPHGqMPsFDVjaqT90/s2owe1ds5oLcn mczVm2Lak0n4hMh3nCfeehcHwA+gy+jzVERDcyEZazPeXd9kQG8BntlVbUNQHb2RDON+ jz7LJUD6llxaLt7SvwhIlbwO50Gc2Umq2JuYCKG59OYTta5AcBwTpHyL1UhiMqeOQdty Oljg== X-Gm-Message-State: AOUpUlEG4AwTjU1EaIbuMslpeTrfpZRx+riAY5Vgp3hwWQVYgx0F1CMR 6/b4k1ZaeSUE6TsKiECc5gE= X-Received: by 2002:a17:902:a40b:: with SMTP id p11-v6mr11299275plq.228.1532317138661; Sun, 22 Jul 2018 20:38:58 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:c122:f95a:1d53:1f82]) by smtp.gmail.com with ESMTPSA id y3-v6sm4986153pfi.24.2018.07.22.20.38.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 20:38:58 -0700 (PDT) From: Jia-Ju Bai To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] bluetooth: btusb: Replace GFP_ATOMIC with GFP_KERNEL in inject_cmd_complete() Date: Mon, 23 Jul 2018 11:38:51 +0800 Message-Id: <20180723033851.8141-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org inject_cmd_complete() is only called by btusb_send_frame_intel(), which is set to hdev->send, and hdev->send() is never called in atomic context. inject_cmd_complete() calls bt_skb_alloc() with GFP_ATOMIC, which is not necessary. GFP_ATOMIC can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. I also manually check the kernel code before reporting it. Signed-off-by: Jia-Ju Bai --- drivers/bluetooth/btusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c8c8b0b8d333..1586c54a01f1 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1870,7 +1870,7 @@ static int inject_cmd_complete(struct hci_dev *hdev, __u16 opcode) struct hci_event_hdr *hdr; struct hci_ev_cmd_complete *evt; - skb = bt_skb_alloc(sizeof(*hdr) + sizeof(*evt) + 1, GFP_ATOMIC); + skb = bt_skb_alloc(sizeof(*hdr) + sizeof(*evt) + 1, GFP_KERNEL); if (!skb) return -ENOMEM; -- 2.17.0