Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5346657imm; Sun, 22 Jul 2018 20:10:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6Fau5P8cWnf8lZC3McLy/C0pcYx2MDyuW0ef+R1C8J0UqOEH1WUg1aT8zZmEU09H82mCN X-Received: by 2002:a17:902:7446:: with SMTP id e6-v6mr11334620plt.161.1532315454953; Sun, 22 Jul 2018 20:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532315454; cv=none; d=google.com; s=arc-20160816; b=UUbbMJOCv/RZwFItA8UyGBq3xpyPcwJ3AoZyvb/m49qkNxMjVqZg9ABWDk1SBK12he u7V/QD535klu5zwr2R6D3RjSI7zqmW9AtFREkZ2PpCcQx0l0Sw6UB3pcDorjx5Dh/ZzV 3bvuxrf0uLyFb5Idnp3a/iShxWVjK3ci6cp9gCeEE/lKfdzkKZAcsUXIULl28avPe24C l7SXJmFkYNPxu0C2UtStePCfYW/Yk88b4xY2C5T2Qk3f/tu3LrtfUhooJKgRsqh44ew7 dOg4EgYLgutddZOgqnyRtcAFPr27qbCEo6i2GVfeW9gSlZZf64ryKZFTzH4XEyamMuhy SByA== 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=q8HqsZ+rwzUQVqFb+oGmZmwsEgSmjkkeIGgBTWpZapw=; b=fxP+6bkZ/nYWON5ycsta8tbQ5alLpI4lTKJkK/gJX/Jh9uLLNKB6Bs7EBZ0PPgjfQt Id8nwR9tsKZ391KQGy8PdBfr1jksGxF5hHERCxpO7C+Nl5eaUwsF2HH6mmjIsazV/4MM 6dTv2vdYoOprdJs5z1Br65hpAVnOnrg96dapPrc6WOF1YT62UbHIvWRXuhztJdhs9dn/ a9A+xrPaUIeaO9wgFlATMdvSPoCLQw6iY5+eh/bKmaj5c9L/6pYDvPkmr0KH8f2mBG1B Tm6ZB4SsNu6Gb2U2erBaNjLw5VNTdRH6X+/p3xtYqja2ay88XlmoxFTtfs/30Bf5xzd3 vE8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sMD1op6d; 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 f7-v6si7486986pfe.291.2018.07.22.20.10.39; Sun, 22 Jul 2018 20:10:54 -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=sMD1op6d; 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 S1727317AbeGWEIK (ORCPT + 99 others); Mon, 23 Jul 2018 00:08:10 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37235 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725796AbeGWEIK (ORCPT ); Mon, 23 Jul 2018 00:08:10 -0400 Received: by mail-pg1-f195.google.com with SMTP id n7-v6so11158726pgq.4; Sun, 22 Jul 2018 20:09:11 -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=q8HqsZ+rwzUQVqFb+oGmZmwsEgSmjkkeIGgBTWpZapw=; b=sMD1op6dLGCu2hDXuwPsHnYi0ZDi4J/q74wA27j0CyBRTL4O1nVfxcY9oVPSC7PIz7 ac48/WPZw3ouiBIIfevlju3vq3IUTSZTfSr115qaEbaFtIp3JtVw6SalUMx5BEI7lAHX CwazGKpgCVQxrAk2v6wkOJYeuaeUO+z1CHvUw99FZUcRfb97DcZthZFgar0di7toQgZd 07hFmeFGLwKPV7P2un7JArQ7NodNq+PSMXWQ4kozxjSbHNIBCy96nL37wo1ntfD2fuBD APBvn34kWwFfz5MX4jhVa7+aZt/vUjN31niUtl02GGjx68pMPF0IYeRLxyoneKgWDA3K WKqw== 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=q8HqsZ+rwzUQVqFb+oGmZmwsEgSmjkkeIGgBTWpZapw=; b=SYOJBiivDQZBG7p9OtpfBg2o0Myi7lNwvMqKhSObwq1L3oX1drQkG1huPbtZWqzWXn h317mVPfn6/dSYGG/4NO5WlzWJTVVib8s63oRTqhtwNb3h6KFFkFMj3Nvqzj7lcuTfS+ bExEvcK1WjTe49I7fXijdxc3QGh4Ymc9SxgDNjNsbfYUPeQmde6eduCuwvYnDoE6+HM6 TMApEf3Tb5Li9XRiN6lJWdYzzIfSDi/hrq1Ovy+hLL/6wMvGx8gnNGHJlCdT2abZEyjp pbCK9c86NVZtJkIXYI/r9eFJIrJno82eAGv5ov7fNi/XSRXxKE1WgM+DUvp/nWJ8g5Fr 4N2A== X-Gm-Message-State: AOUpUlG/CKLeHc9uBw8EvJwwXVVJ8yl+2ewVFEdCxMec6KLkBg2rKTWR 52jOk/XbzDkzdL9nE5guRblqztbd X-Received: by 2002:a63:db05:: with SMTP id e5-v6mr10517041pgg.152.1532315351190; Sun, 22 Jul 2018 20:09:11 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:c122:f95a:1d53:1f82]) by smtp.gmail.com with ESMTPSA id t69-v6sm18918510pfj.7.2018.07.22.20.09.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 20:09:10 -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: bfusb: Replace GFP_ATOMIC with GFP_KERNEL in bfusb_send_frame() Date: Mon, 23 Jul 2018 11:09:00 +0800 Message-Id: <20180723030900.7305-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 bfusb_send_frame() is only set to hdev->send, and hdev->send() is never called in atomic context. bfusb_send_frame() 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/bfusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index ab090a313a5f..0588639b899a 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -490,7 +490,7 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb) count = skb->len; /* Max HCI frame size seems to be 1511 + 1 */ - nskb = bt_skb_alloc(count + 32, GFP_ATOMIC); + nskb = bt_skb_alloc(count + 32, GFP_KERNEL); if (!nskb) { BT_ERR("Can't allocate memory for new packet"); return -ENOMEM; -- 2.17.0