Received: by 10.223.176.46 with SMTP id f43csp849575wra; Fri, 26 Jan 2018 07:53:09 -0800 (PST) X-Google-Smtp-Source: AH8x225RWFdxtO/S98OLBYj1PBIK3XCM4MQDFcs2G8pKHfIHp3/CRgywYhUu1KEIlPdK/Yn5gq25 X-Received: by 2002:a17:902:5e3:: with SMTP id f90-v6mr12571619plf.418.1516981988962; Fri, 26 Jan 2018 07:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516981988; cv=none; d=google.com; s=arc-20160816; b=U10D16mOl81Eoar54Q0visq1JC/Au/CUj8fcCDISweA2KiDjtq1dvQQBdWcEcx3e1e ZH4bcWzpbGj3QLo6xMrSDzYogyt9XVNyIuAb7CJgM3KVl9BPJux5dv+eWCVwU8JHYm7g FSNOSwjCVNnE9ewm824BcwQ9XKNEqxDrksZBSMW+2+FDrKcVz/VJFN5BwtUMjb252Nt+ jxNCXj+hRKwRPKkl+AvCbKa6Yo9V9N3vJHc0h0Sa4Cle133mDpRPJtxkP6rxbZv91B2I NgtShz+efehEqaDqXFJj+MD/UZAnMcX7cEa0ks2IA7AqxXeiXclWRHaG8ax+53PrGE77 1/wQ== 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=+mgTrwECVmUhR1wA1L0JRmJtzq3FMudgsA3W70mhh4Y=; b=tnIdhPYYgF5UlUL78UvG8iYPVRlfXzgEhLnMSI0nsMAei23WQdFe6VA8qrgKTAKFkS iK3SD+b1LqBsgEaIAmL+/Npj4czGU/xxKxQBco0pUWxB2eJdZmDwAfiWGJQQIXKtis1+ Gzthac62HgmCtvH2QQKa77qrFG1xBh6EcJ5jAlMNMMtFuxdJxgVPqd9gOYdzIJHuaHAZ AhtWPk2WCs5bAD9QwhEicUzAkK8bXkhPzDW9OZ6SpcuM8ov5eqVeyVrQ9aYKK1NJ8RKs iz5B6i4XTQHBR06AI0HbAmzviP2+dt7Qcx6dQqRbypvhoixjYxNcUJYXddT12qzUJfOP 7Q+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WgWKNBs4; 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 u88si6487277pfg.324.2018.01.26.07.52.54; Fri, 26 Jan 2018 07:53:08 -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=WgWKNBs4; 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 S1752992AbeAZPw3 (ORCPT + 99 others); Fri, 26 Jan 2018 10:52:29 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:32815 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751630AbeAZPw1 (ORCPT ); Fri, 26 Jan 2018 10:52:27 -0500 Received: by mail-pg0-f65.google.com with SMTP id u1so510605pgr.0; Fri, 26 Jan 2018 07:52:27 -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=+mgTrwECVmUhR1wA1L0JRmJtzq3FMudgsA3W70mhh4Y=; b=WgWKNBs4fhJcpIDsjNgb7Q+aH5b6/n2CI0jsgbbySGX15UFWjvNh1BEdm/P71mTf6l gtCgSEPUub6+Hg/Ue162pexnXWkLc+MFYGH9s/jOSK3hPnAshO/V6mfbMvgFEAP08Lmh WrMza3CdNEN+86qKv16HUAFe0IX146lzTmObTI0w3H/a+fKy52d7PYW6EsGJpqs93UlJ /FYk+NR3xP/SeG/etMv4/FlMz1JwyZfhRBkxSvBJcgsP26dTkXBhHixBubZoze8wLzZ1 8+qalaNgMcNnAjkcqFv3r/kbnYLnTuiiIbPBup+927RRNQezkPpxjMEYPYMRJir+8Pri cnVw== 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=+mgTrwECVmUhR1wA1L0JRmJtzq3FMudgsA3W70mhh4Y=; b=GlQCn6M/Ac2Dsn78G03Hu3T3YuEIN0q0PWR/LQe8CL33hqi9RF0Zt9K8zewEmbuuy+ 0VEywF4Tf5jV+WPKyexlfGu7R5TyXCTQUsncrDsDRmbBa9AfA8/S7gegh94mYIYXC1WB tACAk6wE+F28NKn3ZSgPNebd4PffyeNlvJO5B0wD7Xgr+d6oXFqB1PdCpdU8noep4BzU xtKuJgOTbaXe9+0hVo3PIRp9HHvo1fWOCrIBswfSmyQ9qdnUr6bx4+zdSRromVfkgqqD MXnYfrC5/kk2ghdvZGWTrRUm77FYTfRS+e2rxemZrvSqzHkT2AQKjIBsr+Yer4+ZCm3W XuJg== X-Gm-Message-State: AKwxytdtmMM187MB6px901fXkewMffCOKtQ9/EfDtf2AnQyVJgfUhSXB lKv2PiqLWfKM50f1mc6XxIo= X-Received: by 2002:a17:902:2bc5:: with SMTP id l63-v6mr7476377plb.108.1516981947074; Fri, 26 Jan 2018 07:52:27 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id w83sm19800186pfi.56.2018.01.26.07.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:52:26 -0800 (PST) From: Jia-Ju Bai To: marcel@holtmann.org, gustavo@padovan.org, johan.hedberg@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] bluetooth: btmrvl_main: Replace GFP_ATOMIC with GFP_KERNEL in btmrvl_send_sync_cmd Date: Fri, 26 Jan 2018 23:57:01 +0800 Message-Id: <1516982221-8524-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 btmrvl_send_sync_cmd(), my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And it calls wait_event_interruptible_timeout() after bt_skb_alloc(), so it indicates that btmrvl_send_sync_cmd() can call function which can 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/bluetooth/btmrvl_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index b280d46..f6c694a 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c @@ -183,7 +183,7 @@ static int btmrvl_send_sync_cmd(struct btmrvl_private *priv, u16 opcode, return -EFAULT; } - skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_ATOMIC); + skb = bt_skb_alloc(HCI_COMMAND_HDR_SIZE + len, GFP_KERNEL); if (!skb) { BT_ERR("No free skb"); return -ENOMEM; -- 1.7.9.5