From patchwork Fri Sep 10 16:04:45 2021 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: 509043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCAA2C433EF for ; Fri, 10 Sep 2021 16:08:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A408D611F2 for ; Fri, 10 Sep 2021 16:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbhIJQJw (ORCPT ); Fri, 10 Sep 2021 12:09:52 -0400 Received: from mail-mw2nam10on2058.outbound.protection.outlook.com ([40.107.94.58]:8641 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229944AbhIJQIY (ORCPT ); Fri, 10 Sep 2021 12:08:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lw6rUajUkg/MTnwBBV6DhHax1zAkP0z0wmw64+maeIufo065MJuLgNNoBWF2uPVLnJtdsm8Qn4o8hdIlt3iK+dG2bSsItgfspfSL0O6HNZoY928UyhxMRnHx7o5X68UGKE3hoEiddNPBa/dJ3F29spYAjMRfIJIutRRYROezF/oTP+6LzEhvM/aHxF4RdXLtgFJaBEjqKqsBTQGxtv8nshNOMiT9GQ9EDaeTpxRAMcvyGm7n4gsPSBpBhPPuHr1eEnBt6g1r4+iTZiPpDs/UdPAi/Nm3DnZYI5AomqP4oWBzdUmMBQEZaxdFSuWm2x0eBXyy2vULVPq55iULKurICw== 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; bh=FwmAPHbajhF2+WsJKbgL8BGX7TdC1AgdDDz7sKWPBfE=; b=B70rt1J9PbXaHWF7UvA7PhmoKRw9DGfrlxw8JCuyIe8ko49Ka4vf8dgBOQyNj9fs7D+oNjz5k/fmdP4pXjZ6+Ta8vAjTkvIC/2SP1TWo2auHuIqxIfd0pNtieIawXgK92U99bPyPSJmsbXoHQzsznodsQspOHO3bQoyN7xyihhAbeCB5HAhxdowTVrqpqeYd1Yig/29Qhu3ZnhWQ9BXXhmXsyGaZUHBLPv8Mt0OE5M6kX/n6Qj7EldZdQblVzqS9t9ton3N/Z/UQ91G1OKwTuHuepI+RuBcbxWDkCDhvayp77GNxKplsV1gkYh65l1zlpJiOSOgZp01LJ8FC8Ke8CA== 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=FwmAPHbajhF2+WsJKbgL8BGX7TdC1AgdDDz7sKWPBfE=; b=h4l0YHp7IfGFnuxPsWTWta2NcmctmMOpleq1+2UGkWbKZFrt6aZNqbGBk9FbLj/CN4pFi6hqjU2puHkZEbNqg8hyP7v4NudGmlXSD9xr9yxaP9lFIaAYf0F7MBmC1IhPxPToovbpg/SKayQGCOXrUr9o1U3hM4Se0pboF8xH9Gs= 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 SN6PR11MB3118.namprd11.prod.outlook.com (2603:10b6:805:dc::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Fri, 10 Sep 2021 16:05:56 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::7050:a0a:415:2ccd]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::7050:a0a:415:2ccd%7]) with mapi id 15.20.4500.017; Fri, 10 Sep 2021 16:05:56 +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=?= Subject: [PATCH 12/31] staging: wfx: simplify API coherency check Date: Fri, 10 Sep 2021 18:04:45 +0200 Message-Id: <20210910160504.1794332-13-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910160504.1794332-1-Jerome.Pouiller@silabs.com> References: <20210910160504.1794332-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN4PR0601CA0006.namprd06.prod.outlook.com (2603:10b6:803:2f::16) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 Received: from pc-42.silabs.com (2a01:e34:ecb5:66a0:9876:e1d7:65be:d294) by SN4PR0601CA0006.namprd06.prod.outlook.com (2603:10b6:803:2f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Fri, 10 Sep 2021 16:05:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf480852-6f7e-47d7-48d0-08d97474deed X-MS-TrafficTypeDiagnostic: SN6PR11MB3118: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lIa0RLTpIDLQpUg4NzrHTkfR+o2S7r8Av3obw0DvXZaR6iK3Ix5KVL4q6RQDth5tBzo73Gy3U1wzoBs2LqvsVXiZIAiXxBfQrhRV7oInKF2d6htv7wCHvLShhcST12OSnN9VRquiE/BKyCOnsbeydtXDmnoyDp6bl9qSTBezpddgdLoSr/eqOLDj11op1+Nodltk0nEWtZusiX4dr/yoLZxYWuSVDKxNRaZ2tJ13UYAeqAM/GU3GfNdj8UN3r5n+ihGEpZrTRCwA3gp//MkIVqxRFEbov9tnQBhSqsNaKG+cwkYsSeNZGyiaRS4ZvKWHy57tZ/caCOhKHUMng/5/GN0iROKT5S0I9800H1fCmz2NKjWQ4lqZICLx8mwRnzzwiKWyLTJ9t9KnT92B1YICt3o4XL6B08R1wweK5xaZO4Fw7oSP4atLObwmwTEx+rSXcWWaxP7A3BCPdSwyDUeLdF/xlyYxkOAXCXTV4ik5DI/TaFoMVKt4cAx4v6OjtsgEQokBOMLGxBnhGO5r+mZpfE5lq5EzxDNlOziHc7i7ncP4Ih5lZJmHRL5lZtUAWO/XiyHQCKUmmfbsWb8DzItTEMJGRG8BJozuNd0l79EGxRL9r7NzznApYjafuQ8ULMueiPRrF/Rt/Io1nitS3n0u/g== 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:(136003)(366004)(376002)(346002)(39850400004)(396003)(4326008)(66476007)(107886003)(36756003)(186003)(316002)(6486002)(66556008)(8676002)(6666004)(86362001)(2906002)(54906003)(38100700002)(83380400001)(8936002)(66574015)(5660300002)(66946007)(1076003)(2616005)(52116002)(7696005)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Y9XNTO/JyDyUPnvnqhJvy6GG4?= =?utf-8?q?De784iQVcHyawNrb8UG7KNeYJvQf6PJY++8vsmUAIPwgu0nKV6IcKCeS?= =?utf-8?q?sO2mUoKPywjCDHJYEBQrsjJBIx95Q9ggy7b9/XvkDFbbu7dQ9RllXPEa?= =?utf-8?q?TvXCXl+97jWN/VxpHx1EAY2aJoPbYNJAcxhHwwgqxfu/OktU8xfELkM/?= =?utf-8?q?LMsBfnismpNA791P8dfQRH5vS/p0bKzkLqC7XNjEAwKbiBKMeaPlPGG1?= =?utf-8?q?nzAoKcaTM0hkgK9KnUy/6lHhKX7/EElS6rmqsz3Ol0Qp4xkWOEExb7Qh?= =?utf-8?q?G792YelOy+nrgtDHJU2AwFuDFvSMeOSSZi0zVzdnqUPij9UjXcfok3TD?= =?utf-8?q?RSJYVw4vT6Yqf9GtokAoQRi9AtVaJLqDwa+Om/ouF1iS+GHvwdt+45U1?= =?utf-8?q?HuszDBuu2iKJwcAP7qJFOSOfZm1PDWUmZP9N3gzeYU2zReGLopyXsmoR?= =?utf-8?q?VojqimORWPHFXd7K2zfjDTihUFkg0u9c/29MR3KQ/3b/8WFAjOu/LGA2?= =?utf-8?q?YGbZwlGAjeSUsuK6iAhF19eZSrIsSe7Zf8QohpVF6M4i53U/54x69Fll?= =?utf-8?q?6cDTxsOIS9izD3tWm1cvKwdHh5NyEsVjHCW+1b5gjn2dbrH7JUljitx8?= =?utf-8?q?nXyT3yIoxZDUznQcPfArSS9mmtVgveYKc0gV31zxgcf8xLTTzNlnqBzl?= =?utf-8?q?ELHMvsS5qU9nzoplO3CYAw2uevORsRl9VxW4jhlw0tVIqWIy8AbuJkuz?= =?utf-8?q?i1Z2ukR1jsaz4O6+sIt4PXHuFE0rGqS6X3ayw06lSNGaBhEEXu/KiaHd?= =?utf-8?q?ajX6r6Ev6MhDNjF5Xx8vNnlDDJZfjVxY68j0zVA867C+iqY2h1bTkoSY?= =?utf-8?q?9HI91rmbM9offCM2HatIf/6nBZlTncJCb+loQb+oDZcPVOUDfMM8PMEx?= =?utf-8?q?eQxfr3WTNJm4HfxHZkFRxLAUWKlIVrfoYYQU1uVM+GAsvnSeV9dl9Ifk?= =?utf-8?q?WEIBVmypxluXb0IBYIsI5C+Kw42wFQYjVokU6tx+m0PYIvfrOmQnCAlg?= =?utf-8?q?0nLwrZ5p0uMu1wctLz/77dyDlxkJwADVJESiuU1by2T+NeSF7lwHrhsY?= =?utf-8?q?eGEkleX+Wztnll9/t2OzXJTmxn8GJBauPg+KV0i/UbJdh3tLbsn6A2nB?= =?utf-8?q?Ovnm1k1HAGEPoZBj7tF3oKJzoUQ3CSHUqWMF0JzCmJK/4DT7J0+TxkrC?= =?utf-8?q?CMwi6FCCf+w8z7dNd8oO5Pq2PMtfgPx1FoJXKM1VFMGRC19QPQ8Fr3+N?= =?utf-8?q?+gr4m4DREexPvUJ4HWAbkv3aLEpQReYwVi9LTVtHxpyS1qs/G94DTTjh?= =?utf-8?q?1WODrzcg4V9SEx8DiXH6pXuGr/QbjSnDFPMtcXHfAIowxPPSlEXHOSSZ?= =?utf-8?q?hLI+GRdtOGFrOE4i/wQdqn+oGigzF5teVR1/NNV?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf480852-6f7e-47d7-48d0-08d97474deed X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2021 16:05:56.2502 (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: qb7512ayZSS4YqzFq3IZyMd9umjbVYV4U4sVMDSoYxojIW7pivoAPq6ZCSxKMEUJxwByXp0AI9dIh2DxezOpwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3118 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The 'channel' argument of hif_join() should never be NULL. hif_join() does not have the responsibility to recover bug of caller. A call to WARN() at the beginning of the function reminds this constraint to the developer. In current code, if the argument channel is NULL, memory leaks. The new code just emit a warning and does not give the illusion that it is supported (and indeed a Oops will probably raise a few lines below). Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/hif_tx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 14b7e047916e..6ffbae32028b 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -299,10 +299,9 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, WARN_ON(!conf->beacon_int); WARN_ON(!conf->basic_rates); + WARN_ON(!channel); WARN_ON(sizeof(body->ssid) < ssidlen); WARN(!conf->ibss_joined && !ssidlen, "joining an unknown BSS"); - if (WARN_ON(!channel)) - return -EINVAL; if (!hif) return -ENOMEM; body->infrastructure_bss_mode = !conf->ibss_joined;