Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5355103imm; Sun, 22 Jul 2018 20:25:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcVKRjLRKKCx/XoBFlAb/4eZIdQhQE4FYAsOncUPCYiaT/wQxR/Zmh9CvhSlinIFYXj565a X-Received: by 2002:a62:9992:: with SMTP id t18-v6mr11508088pfk.239.1532316317352; Sun, 22 Jul 2018 20:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532316317; cv=none; d=google.com; s=arc-20160816; b=Hz0AxMrSA+e+dD6y6b9PxelbRFQ6hjDltXpoU3SzPgfYPzVj8Zwimb6ZLOqS0a17+m HgJQy1tzNsi/oiqyyMSh0wqcRziBPcXUw2QGKmNkSWfSOTAPqD73oCzPWoPZMqxuZ3NJ J3XXbIKLqy898twtM8xBbCt2FyOwUuOIkDhEFD4JVE1/NS6N/jt20NL4CHT/gLzutuNq NIH/Has/M5lxLWgvc5Zr96urd8EAzUpSdGIpDnmnuNJez2G0WcP+0midsC+00YYDF7VS do7lFZwIBDVPEbODLc62zcNtUi9vArKQyddZgApyu8TBwgqJ843iHi5/RjvS3eS1HefF Gjlg== 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=4J1koG4+EGfcsIqa6o7V7IMGrrz9tyBAcg5wvF1hAro=; b=k5kRwnEySjxXVZGJNa1GkoXOKYPfj3G9dwUI5dZirBhmIRruO5MotXUehx0pzoxunu P/IMKsBPg52kujIokDH0K/yy7vjkphXFUG44i/UDgAZn7f8cp0aCu/w6jOME2eK5ZXa5 ZpzNgDNgix/+CHxWyXJtYb4x4RpybGKQzz1EA09Jh8TSlnZfU97IQEhCp1Aky+oQAEGD 5rK3wb1AgR4rZLMhEiFevSpZweU9h7PhzwPMUKuOPEmMurjpMNSadPApHfQGs7yGChfe /7pHQcvCtkbQNBdNatMqgbwICAnUNfewwXZZo2oczxwdRY4/jPO1GKHChAfRLsYJ0EhI YhHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZO/O37n1"; 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 z37-v6si7308897pgl.390.2018.07.22.20.25.01; Sun, 22 Jul 2018 20:25:17 -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="ZO/O37n1"; 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 S1728206AbeGWEXN (ORCPT + 99 others); Mon, 23 Jul 2018 00:23:13 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:44289 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728107AbeGWEXN (ORCPT ); Mon, 23 Jul 2018 00:23:13 -0400 Received: by mail-pl0-f68.google.com with SMTP id m16-v6so7620159pls.11; Sun, 22 Jul 2018 20:24:10 -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=4J1koG4+EGfcsIqa6o7V7IMGrrz9tyBAcg5wvF1hAro=; b=ZO/O37n1BrvctJNO5U7d81ZjYEYtSXUjFac4czg/nRteXRWmqEzfYO3fG8GDB6hTdv vt1cRLDUFHRecLsmzGdN2YskPfrBJ/377g1LiTIEVsvQckEaWqOz4EgF8DNPRIbzJyKE TMK5RIT1H5QfmlaRP/0ikNtnjUfhDXEGOQlR6JVZaZqEwq7ytHQKSkTPgYKDFZKCY+p+ 78RxnYF1pPfLWhjFOWvLK1LpBSJl2iHCqj0OEHGnlvEnoRnmnx/TbLUGIeXfj9eoQf0Z SnwYGX7/31I4TO+3AS5BGPkNUoFy6u/juWktH9YgZ33vrbvK51Fk/MyUXEZEPF5toKk9 5Ybg== 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=4J1koG4+EGfcsIqa6o7V7IMGrrz9tyBAcg5wvF1hAro=; b=ZnjbVA5adjp/WVFz0Aq56nOEKrTs9/bZ/DbF2NMBwgrzXFQ3wniTf3goBERdHzYufP QbaHA0bcV85ZtKwGXYagTffH4rpAVr9jVyI5oo97wbrm2buu2r+KFQc+OFPMJJsJaWxH g8YyI/hUK3VbXLFCZHHqWAcfAE890+MK0Q1us3bqPMnNzcc09WTlDjzeCHQGbWxr/Gja Gl6778UO5aU2dhBYpaX2J0KfNFAZ72smivnlbrzfsoEKBx8RN2BfxTupxt0UXWkN3QNe xJywuMESVO3b3iad8Kql2r4F0yz/h7DhGVPam0wcme0dsyHWpi+amZNShc0nENmfkHJP JB0g== X-Gm-Message-State: AOUpUlEacoKE4Bf5PRl6iVEvgg5uVkVLUZzOYQ0gZG4Nev9Dm/WQCkJ2 U84FDoDc6Zd2l3EI5FVd7pWAyMui X-Received: by 2002:a17:902:561:: with SMTP id 88-v6mr11158501plf.320.1532316250673; Sun, 22 Jul 2018 20:24:10 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:c122:f95a:1d53:1f82]) by smtp.gmail.com with ESMTPSA id g85-v6sm19147834pfk.39.2018.07.22.20.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 20:24: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: bpa10x: Replace GFP_ATOMIC with GFP_KERNEL in bpa10x_send_frame() Date: Mon, 23 Jul 2018 11:24:02 +0800 Message-Id: <20180723032402.7676-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 bpa10x_send_frame() is only set to hdev->send, and hdev->send() is never called in atomic context. bpa10x_send_frame() calls usb_alloc_urb(), kmalloc() and usb_submit_urb() 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/bpa10x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index c6f7cc57db14..d1c2adf08576 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -289,7 +289,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) skb->dev = (void *) hdev; - urb = usb_alloc_urb(0, GFP_ATOMIC); + urb = usb_alloc_urb(0, GFP_KERNEL); if (!urb) return -ENOMEM; @@ -298,7 +298,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) switch (hci_skb_pkt_type(skb)) { case HCI_COMMAND_PKT: - dr = kmalloc(sizeof(*dr), GFP_ATOMIC); + dr = kmalloc(sizeof(*dr), GFP_KERNEL); if (!dr) { usb_free_urb(urb); return -ENOMEM; @@ -343,7 +343,7 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb) usb_anchor_urb(urb, &data->tx_anchor); - err = usb_submit_urb(urb, GFP_ATOMIC); + err = usb_submit_urb(urb, GFP_KERNEL); if (err < 0) { bt_dev_err(hdev, "urb %p submission failed", urb); kfree(urb->setup_packet); -- 2.17.0