From patchwork Mon May 20 02:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Hui X-Patchwork-Id: 13668008 Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id E1C664C80; Mon, 20 May 2024 02:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716171425; cv=none; b=uBsgMOMDuNV6JL7jB0W83u8B/hiOSuhASMHzvDXlyoTG8hr+OduI560JQXLV2ez5J5KizwqUh9HI2G+ysYw/GYILHfIj6LkA+MiuoUYTFnrxub8aiJuH4G9yjmCbebd3FHlXV5RgPMPpMzAs5MmdW6pioLFud2D3tO73XOK+0lM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716171425; c=relaxed/simple; bh=XHIQ95g/vueEcW57EIQgD5QSEjqfOnGsPYbNMssLwlQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Zrmn2nMx5RngrEIZYVRtDMSJ7Ff7owdPDk9w4SKsKSV5PeQxnyA3SR66PRXE4TOCHSRa7gI7Ns41odQKJDGyI+yx+4AqisYkKi0XxWVye2xzivMZ7LDu5Dd5FIBX6BZM8jvQu6pwI3/ScdhmEJzpWP/2afMPchrujBShdZb29ok= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id DE43D6026E8D1; Mon, 20 May 2024 10:16:49 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: marcel@holtmann.org, luiz.dentz@gmail.com, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com Cc: Su Hui , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] Bluetooth: btintel: remove useless code in btintel_set_dsm_reset_method Date: Mon, 20 May 2024 10:16:25 +0800 Message-Id: <20240520021625.110430-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Clang static checker(scan-build) warning: drivers/bluetooth/btintel.c:2537:14: Value stored to 'handle' during its initialization is never read. No need to repeatedly assign values to 'handle'. Remove this useless code to save some space. Signed-off-by: Su Hui --- drivers/bluetooth/btintel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 0c855c3ee1c1..f1c101dc0c28 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -2542,8 +2542,6 @@ static void btintel_set_dsm_reset_method(struct hci_dev *hdev, RESET_TYPE_VSEC }; - handle = ACPI_HANDLE(GET_HCIDEV_DEV(hdev)); - if (!handle) { bt_dev_dbg(hdev, "No support for bluetooth device in ACPI firmware"); return; From patchwork Mon May 20 02:16:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Hui X-Patchwork-Id: 13668009 Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id E1C9A746E; Mon, 20 May 2024 02:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716171426; cv=none; b=nE+VTPYTSuW+/kgOvFdCSC5ByzQoKSIBZsXlD4O4UoFqsEXoZrZyKHiPfMMoKHOBuq4ICAAug3D3V4RRuxFeWoR6iIUfI4FyvuJE5b1G7ApPL9tEE2C/tnHkDmH/ZP27kW9TxRvoMW2MvLBAkv/VX+KH9x/JthJOwKj/pcPtErU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716171426; c=relaxed/simple; bh=gvbWzLdHHAwB+c4e8VFjeusevcuOlKHRkliYwF5b56w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version; b=dBAwVFLAKvPvAuOWzWQ1jcmvJUA5cLJ4DvyQFX2cIF4C39qDwiyTFq8KPJCbSO8UeRUeTgDqPwHzbNQPa5o8vD39Sz8unXw02P55ILTPbIAXsp4ezvg7JviR48laU0aKNaB6ULZlsixAH2YSJQmZxcO+slBc785SD+DYHENjKMo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 0246C6026E8DA; Mon, 20 May 2024 10:16:53 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: marcel@holtmann.org, luiz.dentz@gmail.com, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com Cc: Su Hui , kiran.k@intel.com, seema.sreemantha@intel.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] Bluetooth: btintel: fix use after free problem in btintel_ppag_callback() Date: Mon, 20 May 2024 10:16:27 +0800 Message-Id: <20240520021625.110430-2-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240520021625.110430-1-suhui@nfschina.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Clang static checker(scan-build) warning: drivers/bluetooth/btintel.c:1369:8: Use of memory after it is freed. 'p' is equal to 'buffer.pointer', using of 'p->type' after releasing 'buffer.pointer' causes this use after free problem. Change the order of releasing buffer.pointer to fix this problem. Fixes: c585a92b2f9c ("Bluetooth: btintel: Set Per Platform Antenna Gain(PPAG)") Signed-off-by: Su Hui --- drivers/bluetooth/btintel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index f1c101dc0c28..d94a8ccd1428 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -1364,9 +1364,9 @@ static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data ppag = (struct btintel_ppag *)data; if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) { - kfree(buffer.pointer); bt_dev_warn(hdev, "PPAG-BT: Invalid object type: %d or package count: %d", p->type, p->package.count); + kfree(buffer.pointer); ppag->status = AE_ERROR; return AE_ERROR; }