Received: by 10.213.65.68 with SMTP id h4csp3912037imn; Tue, 10 Apr 2018 06:34:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx49x9LpaLxWBQEJRz/j2U7hHMzV9K64OaRlgkc8eF3MfsHUt30RYWbVZIwv13/yz9aGGGznw X-Received: by 2002:a17:902:158b:: with SMTP id m11-v6mr485980pla.300.1523367287953; Tue, 10 Apr 2018 06:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523367287; cv=none; d=google.com; s=arc-20160816; b=ZwrAU3UN+Kc1ZJovZAVWhG4plJtzKxduakxKfNUbcw8WVWqDdgPfJgl6jPPsoSYzFn LxLlW5HBpNILvKGWaXXcdvTc5F5SJqOV7AlUK72x1FYEQ/eY3UrOxvl3uZfKtHqmajgY 8/HlE8SmmYFnET+9OgFJtr7aJSqjUSExmtvGUm6jL7TFoAd0ePRPMUb5YG2zuGpI2dFd +K8xOBnm7qJzT8xPQ4/d49Uy7A/jRtrbKD4IVBnWfF+eyR7Z7ZMAynZl0EjJZjBaAI2e h+q5VgbGanR9QOZUQgg6NB9bAOpRaSErgz47f0r1yykqecloDsb7QmzJ6ufzmMZfHHM8 9X+Q== 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=QW6N6LCHgsf4Arz8AZHxcW+xmno+M4otmLu1qC9JFVk=; b=W7J4PTpDFzPU0j79SGaf/RI2B9L6BqkEiZHtYSinkT/t55pwUVEu1aF8tdkWyItFGr NpBYQbSUSPJrXOVLXvaant0fO2HQ4R2HUL2STr3eHgB3aC8zctnXrDlsSGl4iyQUqQVP rgtAecYbxemMqiuEB1rF+iPFFbxAStMQ1fNnCkF/NFxEFsZveK0q0dZ07B3YpXchkeY7 gzBKedgSASlP0wrCxO3x9QNBusIoS22ko5m9rly9KJvSPO1DxQmBRX7875kjM02LVitz 5Gx2bZejiAT5D6isu2X9E21C/LU9aTOvTISj4W30S8aCFd4IMjBue0r+DKPnWiatR4kR GMHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cjs07uX2; 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 x4-v6si2796488plr.391.2018.04.10.06.34.11; Tue, 10 Apr 2018 06:34:47 -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=cjs07uX2; 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 S1754036AbeDJNad (ORCPT + 99 others); Tue, 10 Apr 2018 09:30:33 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:39151 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbeDJNab (ORCPT ); Tue, 10 Apr 2018 09:30:31 -0400 Received: by mail-pl0-f68.google.com with SMTP id e7-v6so5510856plt.6; Tue, 10 Apr 2018 06:30:30 -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=QW6N6LCHgsf4Arz8AZHxcW+xmno+M4otmLu1qC9JFVk=; b=cjs07uX2hdx+7kGzfHcfBQRk2zO/eLPGuDW9OrQ4AiSKzGDl0hW22VappYugjn7AWH uBXHZ3sjloLQWwfbNr9TywVZAlC35x017Sar77ndAPA2OMUy5SeyUZLuHLDKdFqzECgR n1hpLGebd8JtXlg1C+JkpkZW5A45KuOfs38IHveZyeFILxEx8NQQOD7xFGThADUZTG4W DrMYEZcEbDLzZnGbypmDZfLpe8eQpivVwiqjV9qtKmFS1MKJbpJsti4Bv5dWZo5JXX5J 26dbYIIDkc6n2Ul2qnECi4MTUdcldWuQgGRol/tQfz2PtDiilsjxfWvJHB/rp5ROv6wL V0ag== 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=QW6N6LCHgsf4Arz8AZHxcW+xmno+M4otmLu1qC9JFVk=; b=GtwnuAB3xxDmw2ex8y9szqUqnomgTe/0d28AYZGR2qvtkgoG/fLz5bIs3IpkBITbGc udO6kHTAsIAknW7BNgp/WL4Pcq7ETRS588l5vwfFEU7hHeTM73ONPx05C7fTToTzDkFo dcQIi/4sd8UmKiyKJlOK93IdNcWGpLuGDQrEO2zPeooUSoQT5o1l3lWGDa99yzqE3Olc iQj7e8jc9FfupYlMIQlrEsEbXQkE7msWxW36l+0bhtuVUPoJ8bbIsFutxza2AZgtecsP yxNA6z059brKh8U7QFxA/Ynl1JIJtGt9c2c2PY48L9uHRsq6bI2yw/nudHSOUNmwEyPe /FhQ== X-Gm-Message-State: ALQs6tBxTOJumfsjqf69ibPKnxyME0R4PaX8oplhQ3z2z7cr/zU4+EiE MznVGdE4qVw0i7zeKrZmdzQ= X-Received: by 2002:a17:902:7b97:: with SMTP id w23-v6mr463387pll.45.1523367030698; Tue, 10 Apr 2018 06:30:30 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id f12sm5290078pfn.47.2018.04.10.06.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 06:30:30 -0700 (PDT) From: Jia-Ju Bai To: kvalo@codeaurora.org, davem@davemloft.net, arvind.yadav.cs@gmail.com, johannes.berg@intel.com, stephen@networkplumber.org Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/2] net: wireless: zydas: Replace GFP_ATOMIC with GFP_KERNEL in zd1201_fw_upload Date: Tue, 10 Apr 2018 21:30:23 +0800 Message-Id: <1523367023-31981-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org zd1201_probe() is never called in atomic context. zd1201_fw_upload() is only called by zd1201_probe(), which is only set as ".probe" in struct usb_driver. Despite never getting called from atomic context, zd1201_fw_upload() calls kmalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/net/wireless/zydas/zd1201.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/zydas/zd1201.c b/drivers/net/wireless/zydas/zd1201.c index 581e857..cba2bed 100644 --- a/drivers/net/wireless/zydas/zd1201.c +++ b/drivers/net/wireless/zydas/zd1201.c @@ -74,7 +74,7 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) data = fw_entry->data; len = fw_entry->size; - buf = kmalloc(1024, GFP_ATOMIC); + buf = kmalloc(1024, GFP_KERNEL); if (!buf) { err = -ENOMEM; goto exit; -- 1.9.1