Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3284589imc; Wed, 13 Mar 2019 13:45:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQ9pZyBdDpnx7rDhA6//ia3aQrnCh6GuRm4cg4Wp3Hf0SmXrFodgvq1Kh5PVpIhg6JSvFR X-Received: by 2002:a63:1a5d:: with SMTP id a29mr38928906pgm.369.1552509900298; Wed, 13 Mar 2019 13:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552509900; cv=none; d=google.com; s=arc-20160816; b=UTnkLOCBF2DoHq8L78pY3k0C25FPypE1+YivFbHkdeXEL+cKd99dkItK2qdM8Vzf0T 2f9GgVn934BMBAz2YBeVufIhzC7tTgODzxcbaGJhMXWoGvH+v3tjm7DguChCiJcacB8s FGYNYWLdY4IVtiwDF+7jiD/UCmYdrHB+On1KpG+QqVQGnCXCHeqL0BuSHDo3RdbM98Pk cJiIQT1JXywG163OWJ2DAs8D2BhSHcURxVNxW3OAE9vgbTUrOO/4NMNtPyGCzHUfJqKk 79Ejap7GI2J61d25bemCBbtvBIG5f7BE0hnicSf/aQ1yN/vgdKhpoKp9+htHApUdEcz1 bh4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8RgZB8B4MsBTUesmwujvY+vPSY2K2Pl0MJLmHankulY=; b=KcpI2OPw+VTJW0mG7VUjpxqjStiiGDka6AuqcNKFTFORh04KIpwfAE7iEiZRXVVnuQ 7lYLwCZTBO9V20p1/Sq46S1zufDbsMBcaKmpPUYI8Lpmx4FM5Vd516z3k9wGXJW0GuRY WCcZ/E+rcGTCMiGXQace4Evzp4Nkzp2MVp7B8CvRTo8N8knp3Wnk426S3VQCvdFixFl+ GOnjttAsKzDx1yqofWXbyMqx2G45LUJ9fmcYEhqHL7QXFWycJGb3/OZRpn3NR8DcOhNm 1vQR45N4aXsjXKynNIfAvDClOUh/cCxFtAPfylrjCSOLpMMNpqeODxOU7pevjTKpfiy1 eBxw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d19si10705868pgv.522.2019.03.13.13.44.43; Wed, 13 Mar 2019 13:45:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727317AbfCMUoG (ORCPT + 99 others); Wed, 13 Mar 2019 16:44:06 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:54850 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726263AbfCMUoF (ORCPT ); Wed, 13 Mar 2019 16:44:05 -0400 X-UUID: 75fa09407f474761890b319349a1ff02-20190314 X-UUID: 75fa09407f474761890b319349a1ff02-20190314 Received: from mtkcas09.mediatek.inc [(172.21.101.178)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1971916305; Thu, 14 Mar 2019 04:43:59 +0800 Received: from MTKMBS01DR.mediatek.inc (172.21.101.111) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 14 Mar 2019 04:43:50 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01dr.mediatek.inc (172.21.101.111) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 14 Mar 2019 04:43:50 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 14 Mar 2019 04:43:50 +0800 From: To: , CC: , , , Sean Wang Subject: [PATCH] Bluetooth: mediatek: fix uninitialized symbol errors in btmtksdio_rx_packet Date: Thu, 14 Mar 2019 04:43:49 +0800 Message-ID: <8fb8e6840a39127112597963d665fbe6c21d8b91.1552509647.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-MTK: N X-TM-SNTS-SMTP: 7FF256FA8C5FD05FE0A2728A0DFCD430D3B76E5B217424355972E7CC225323A12000:8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Wang Fixed all the below warnings. They would probably cause the following error handling path would use the uninitialized value and then produce unexpected behavior. drivers/bluetooth/btmtksdio.c:470:2: warning: ‘old_len’ may be used uninitialized in this function [-Wmaybe-uninitialized] print_hex_dump(KERN_ERR, "err sdio rx: ", DUMP_PREFIX_NONE, 4, 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ old_data, old_len, true); ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/bluetooth/btmtksdio.c:376:15: note: ‘old_len’ was declared here unsigned int old_len; ^~~~~~~ drivers/bluetooth/btmtksdio.c:470:2: warning: ‘old_data’ may be used uninitialized in this function [-Wmaybe-uninitialized] print_hex_dump(KERN_ERR, "err sdio rx: ", DUMP_PREFIX_NONE, 4, 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ old_data, old_len, true); ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/bluetooth/btmtksdio.c:375:17: note: ‘old_data’ was declared here unsigned char *old_data; ^~~~~~~~ Fixes: d74eef2834b5 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices") Reported-by: Dan Carpenter Reported-by: Marcel Holtmann Signed-off-by: Sean Wang --- drivers/bluetooth/btmtksdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index b4b8320f279e..23cf63888bac 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -372,8 +372,8 @@ static int btmtksdio_rx_packet(struct btmtksdio_dev *bdev, u16 rx_size) const struct h4_recv_pkt *pkts = mtk_recv_pkts; int pkts_count = ARRAY_SIZE(mtk_recv_pkts); struct mtkbtsdio_hdr *sdio_hdr; - unsigned char *old_data; - unsigned int old_len; + unsigned char *old_data = NULL; + unsigned int old_len = 0; int err, i, pad_size; struct sk_buff *skb; u16 dlen; -- 2.18.0