From patchwork Mon Oct 19 16:06:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 11844679 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5017614B2 for ; Mon, 19 Oct 2020 16:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28C2E2225F for ; Mon, 19 Oct 2020 16:06:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="Z3XfwT1a" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730506AbgJSQG2 (ORCPT ); Mon, 19 Oct 2020 12:06:28 -0400 Received: from mail-bn8nam11on2051.outbound.protection.outlook.com ([40.107.236.51]:30081 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730320AbgJSQG1 (ORCPT ); Mon, 19 Oct 2020 12:06:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXqS4D4BH7CccWuKtmfPzTGN09y8hAg1RL2EsbwhTF1JMdETHNpDFk5UBrB/PsPbos8FUPx+QqR1L5hlFfhaLNIVrJbQrIzARrglL8v9h31GA1zkyxijZv2g6hFIQ/csdU3L+ElQw5Tb7yWUq+cSbjC4GssT+hArDu1KffEQoFk8OVH3gFV8Wl9tZq5/hfVR3/t7mM+qOpsObYWL7qKR//SV8aA+DrkIxzUrSQMRJ+bI0UqnD6XNLx3ESQsYal/td4wmVWDJ0nFom0hxl4gsn/hEUxbY1w/dbxkjUd0ROTYDeygzOoKgXuD+68EE6fnmEii2hDGGFXYQHL97JdWtuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Co6dGmH4SD6AAetVLlUR+nXTWfolf7Say6+3lluM7fo=; b=Sd/YnsmNKQvmMaNMpe+5CqaIqUIYDQCh3Kaf3Rtx2qeCpEKPdwvbfuNLAsXZXuliJ3dC+cBKLR21biqMT5X/DcGXECN0PKsXo8zLkhcMlTeLg42YZW5rEwdnX4xdQPMfqBP+pUjqvrvibgzYkue4PqI/Dkkhob7/7Xa1ld8sZTh/77pmpoguw6jnK3IwMEWDmjgdA2PdxLYwxUnrtHXS0etdFQbDE6fTlYe02Rg88oah43eSIVllPwCsNQgzCrApeBKtT+MGb1Yo2eZTW0C+2TLrQEqi/VofuVeQVvgtM8XBn27o66lixGouBxEdzRRzxgr3e3s//2qJWKAO1tDNbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Co6dGmH4SD6AAetVLlUR+nXTWfolf7Say6+3lluM7fo=; b=Z3XfwT1aM5FxBM/vZWOXIBp9wcq+Ky0YDXKHZtFEVLlKnXgI40frkGr7jPsF7zYKV/e70dTWqo3sDezEBqznFmGh9qKhWEzJMPSSxEwtgkQIjB475S82uivNLkmabfl4/nsSHBu8wW69zcpfhTB14nQ0B32/6J4HpFSGnShBtD4= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none;driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) by SA2PR11MB5129.namprd11.prod.outlook.com (2603:10b6:806:11f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.27; Mon, 19 Oct 2020 16:06:24 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::4f5:fbe5:44a7:cb8a]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::4f5:fbe5:44a7:cb8a%5]) with mapi id 15.20.3477.028; Mon, 19 Oct 2020 16:06:24 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= , kernel test robot , Nathan Chancellor Subject: [PATCH 1/2] staging: wfx: fix use of uninitialized pointer Date: Mon, 19 Oct 2020 18:06:03 +0200 Message-Id: <20201019160604.1609180-1-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.28.0 X-Originating-IP: [37.71.187.125] X-ClientProxiedBy: PR0P264CA0225.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1e::21) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (37.71.187.125) by PR0P264CA0225.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Mon, 19 Oct 2020 16:06:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15ebb35f-f089-47fd-2389-08d87448ed77 X-MS-TrafficTypeDiagnostic: SA2PR11MB5129: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yyyObbQxzjw5UpK42fAOHCoIDMokRhZBcTjf7vhYSigi+Gty936kgsOTGnM7yRABPksGzxROYaZW1KbfLIsPfRFN6RO6JlgBv3Sea5fMajNIkcpaNrka9IwWK3Qx2J8/JvXNpV/8FECJwtsx1stJh6uPD5/7lIS9r9mdO6gyEBr5RwttmPeiR3f21soi3bvtGddAaSRLp3sYC0PH0YsJzMInA3UoKiDXQA2QNMafYfORcT9092FZWfhqydOlBLOIg/WF9scD6+p1AqrsPXgMJIjZy+TDnOfr5ViqF2LiWLqXG56vMa8dySMQ3m6ILdXk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2718.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(346002)(136003)(396003)(39850400004)(366004)(26005)(8936002)(54906003)(186003)(6486002)(16526019)(316002)(478600001)(8676002)(52116002)(7696005)(6666004)(2906002)(4326008)(1076003)(36756003)(66574015)(956004)(66946007)(66476007)(86362001)(2616005)(66556008)(5660300002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: XG440Te/cMYsrd0DmOHwgF5/hKgmxUvoGMMZ1eFV2vnqKD5EbcshZdu59XTY16VsTtIIJPKHFUa8CyXOwl9uOLFPtaYbIKf3T4Bq1f/DFBUcWjrsDsFrZuRTMfq/HezA0PEqjsvzgCEtA+TBbN+aNX/W8GBCF0HpHJ+t8JV90bEIZOI+8yOfNDMZ/UWCas5lUqNpS+pHyBaoA3oy+sMe3v2AepxrCMUvRA07aWESXINcCJHZKy+NZE0CWybwH+SGbKB8oX66teX6d1I+DUda6B3xqhRG0oFsfE8mmTXgRjB9zznnYEVrx4KUoPcVH7N1HvVM5AanYxSnXoFkFiQyd7CCPU623WHDgSTNeXFVhXxSKVGFSPbd5C+TI8KUzWPRnUlgCVm6nTAwipLEnRaLj1gLRvZKanp6A7qjrmlUwRDMn0iobrpd4zqSvzJ3tkGVCL+hRvPW8P8e7cPL8KAuf1FmRHB/X9qqz+ZRKFzNSQ64m7W3UzIXMmne1vLruCJKl+J+43ey737GUtKbLAbFomumuOx03hFCgXkd+nvaeWaNMkjoo4sME5U3FKv/wICXVzP+B2MH5sjG7irKsikrM59Ocyv09jBuK/AhY6PrnINCV8qghgmlYwhF9z7hR7abl+y9HQDxDNbOrxA7iI82qQ== X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15ebb35f-f089-47fd-2389-08d87448ed77 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2020 16:06:24.5649 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F2fpIke7WEJN9xGDyCOCFhhTWIoFdu8a9HNlSaz2f8pFpe0ZpJiD1XhcqXj1EkVfzeWGkIfEK6zvYgYH98eOuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5129 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller With -Wuninitialized, the compiler complains: drivers/staging/wfx/data_tx.c:34:19: warning: variable 'band' is uninitialized when used here [-Wuninitialized] if (rate->idx >= band->n_bitrates) { ^~~~ Reported-by: kernel test robot Reported-by: Nathan Chancellor Fixes: 868fd970e187 ("staging: wfx: improve robustness of wfx_get_hw_rate()") Signed-off-by: Jérôme Pouiller Reviewed-by: Nathan Chancellor --- drivers/staging/wfx/data_tx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index 41f6a604a697..36b36ef39d05 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -31,13 +31,13 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev, } return rate->idx + 14; } - if (rate->idx >= band->n_bitrates) { - WARN(1, "wrong rate->idx value: %d", rate->idx); - return -1; - } // WFx only support 2GHz, else band information should be retrieved // from ieee80211_tx_info band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]; + if (rate->idx >= band->n_bitrates) { + WARN(1, "wrong rate->idx value: %d", rate->idx); + return -1; + } return band->bitrates[rate->idx].hw_value; }