From patchwork Mon Sep 13 08:30:24 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: 511651 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 C1B89C433FE for ; Mon, 13 Sep 2021 08:33:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA7626101A for ; Mon, 13 Sep 2021 08:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238634AbhIMIeh (ORCPT ); Mon, 13 Sep 2021 04:34:37 -0400 Received: from mail-dm6nam12on2050.outbound.protection.outlook.com ([40.107.243.50]:38689 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238219AbhIMIeF (ORCPT ); Mon, 13 Sep 2021 04:34:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DDMc7D+maD11eJLhe3g+4D4jPjf8ngCYGn1ER2BivILuiyd0KXiSPDq0zCePxN9bhv2IQLcQGYkEihxKeqU6hHPxMwrs8Xs1gRnu00G3kKoRhI0KohBHgeygcXz1eGKtTsEwtb4vlV0OkpsUklorx3cAHUK53rTqy3jMQT8wWLWHeBJfYRgIdlZMuZlYVT7yE/Z11cfYaQqNcMdamEiuCd6iAo1S/ygk49javhhvQWa+yQXDG3+PAvufuw7gt6L2YXFx+21ANe7g/0phVVxhzXYMmYx9kH/wZkq9gHRZG96YOlIz4kbCSkUJUKJ1cpCSxp9IC9jG3EsHh18SSiKLNw== 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=Z/Kubct9VVKetEwUwiMRqCvKoGx5Ufqj0bgi+gpkSFx4x9uNYnXMoaOnO5ofMh6XULXsOg6f7YKknCUKTVfU3mCsRuPKyZZeeB2j28YFta/BaX0rO+da7AzU+GDczAQr7XoVJQtP06lLvV2nDR2XUZiCkO2rkyssEN21mokK0QYs5CARbqMS0jSLsAS+nJhknw82kc8ZREuGEezX3VT/FdXtDqXwU8XYWz1t5lu2RBcDQFpmQiTb2JGaZdWEqc4G9VhApqc7VdgmgIlC3WsiVmw7ruUiDDlysAOWEqzJRJrIPpE6Q55icvXWO3mb6dP+S/HhNvoSFHzw9M0U4Vfrhw== 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=g++asta1U++LetZ1aNkGT153DaMO1DNi8KVjJe/wZda2kc7DsQLHxDbJ9NNcqwyzhFAm4xkgz2SzbkW/ifxZ5yDo4Q8JIk202K4AN9purHxUk0Sx24KKvmR/YmzROfo/bRlGiaamLxZkRAWfAU5PXAT+R4ZtnflaRsAZtGPd7Iw= 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 (52.135.97.18) by SN6PR11MB3263.namprd11.prod.outlook.com (52.135.109.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 13 Sep 2021 08:31:51 +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; Mon, 13 Sep 2021 08:31:51 +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 v2 12/33] staging: wfx: simplify API coherency check Date: Mon, 13 Sep 2021 10:30:24 +0200 Message-Id: <20210913083045.1881321-13-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913083045.1881321-1-Jerome.Pouiller@silabs.com> References: <20210913083045.1881321-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PAZP264CA0067.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1fd::10) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 Received: from pc-42.silabs.com (37.71.187.125) by PAZP264CA0067.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1fd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 08:31:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eae71990-c9ab-471a-cd29-08d97690e00c X-MS-TrafficTypeDiagnostic: SN6PR11MB3263: 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: GLVh9zFP96Jx92fh4K0iERFk3vb6A3snP+guyXlgBiaPOdjyDTpSrIvYWXTzi8iMnWdJKxubfV5kzd455atdd7s9yNdIrJfQpkUPMwxLFBPeVlL14AhVZdSz/Grmpfz87YD/raaSFYM0NnLrPtloKjfKgNnlAMRZu7C17JypgkdmmXKad/2fAa1SFbFdd9zzp6VB3JqiQP6kjv74rSPHbCyeJDAW3XLDSVMtjuwGybXkrjT39dlB/M5JBnuzLI1Sq5ww5PJwww745RtDzemgZ5T8+DuVO9pLQQIsSJCPP3v80KKA3Mw8Q9EpSioy7nt/thPgqJ9mjnF7Hsc94GX+1Qn1KC6HbQLGqct8BPsxzD+spEWL4SPBNWUVnW/tMu3cR3m44hSiY4Xp2bpGa7WK4kfZ+CvsXXEel67L1DKUtbLsAliA1RZQGcynEBch+fyK0w44IfZ8Zjx+8OzpVEeadyGP9k2qZs5Djlfw+bEdxtwKxrJ0zkeIto4vNxQKlpOExSW+qlaCL9MDsFyG8kbVm6AfKIEtpSNKo67/gqwcUy23AAUi+0UmFLnsdZ1Vc3vfm2lzH7W2W6NsVIRZk68uFc4MYS50W4l9hRDC3s8v+Jrm+FDrC87MqHA/oU1P3tkHv8zucCJM+VuHDTg4sMzYQ+f5uyTKrwnYsIKOisTowfWTOytxT8YjVlpYv2tiaccbmNHqvLgLFHk19TS962iy+w== 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:(366004)(83380400001)(66574015)(107886003)(956004)(2616005)(5660300002)(54906003)(38350700002)(4326008)(316002)(38100700002)(66946007)(26005)(66476007)(66556008)(186003)(8676002)(36756003)(8936002)(86362001)(508600001)(52116002)(7696005)(6486002)(1076003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?9z5J0V94lIM0fiIBNn3R8DGuw?= =?utf-8?q?maFII19dmAH2/NkCv4IidXgNi3JlYZqOk4RLIrMBDSj5v6p5eTSR803T?= =?utf-8?q?gnzQxWvQx9eGVSZZExTFa+ZJsT/E13nBApDsfSydJEeAyKypMEOZsFRl?= =?utf-8?q?xptfwxmApda8nxHrFwGZXVos8q+htNsMUjgLWFX4TSx0hOfotU34CJz6?= =?utf-8?q?5ZHsWTGhS6ypTJqRnyxrytWwTnBAEY5K0o3Fp1ouwa4n5lk9GRToA3e7?= =?utf-8?q?q4yVd4EkQbKgUKcMz8WFqLyTwMlefdoaCDZrFkZsGDFuucLgRqMu/sSB?= =?utf-8?q?VvzYOK0PgfmtaazNP4sWKO82LvZd4otQqXjudVCRu0BrKZ9973THpttk?= =?utf-8?q?BukC8D8DXx1TnoeTWrOVir8ML4scS1KHiM/ORYBoY3aULX/QLGIjPzmd?= =?utf-8?q?6WyXMgCQVUeLMI4D+a4ApJ84M3+F4HdHT3QVfjUWkOjmKNVjshvB3G9O?= =?utf-8?q?aYh8ext5MF3KrDj88vD9JIYdLfIuv626XNqb+iGhQX/1r6Z17LXTcDY0?= =?utf-8?q?cp343lyka3jdLaKewBwFaZrI9qTnPtc/JrT7iU1YbLJcq2Dkel/Ms59V?= =?utf-8?q?q8SkgEnH5fB2aCfC+Ue+qMqBBC1L3tgLlFh1pwHaoChVsLuYym7kXiZA?= =?utf-8?q?eMAqriAFc/Dk6DOl8koKEEOPMgii4wCoCoW5LS0/J0nrxd5HcWesBtzr?= =?utf-8?q?ZdYzZDGlsZzYMCD+ZpU3UdcU8UnvwYArGjBkpVQ+/rGY+fXWqtB+LztJ?= =?utf-8?q?uB87dUouCZOJ2xITRQDCPPQZVhRBgR84OYA0WQ0u+jxnQeOWUzNhYkoc?= =?utf-8?q?YhiNhyu0R5jrjwR9o1Jce9GYkCpanD1aBXecnsfz/TNpUfxLAXI6F+dG?= =?utf-8?q?2xQEY8qMZyhNxUKTkAxcdtYz/YXQ5+An8XfiomNMuSESq2kdb9ooVd+z?= =?utf-8?q?y/pVm5o67IpFf/nWubetE+DzdfvfbLjVbYcdkcINCTqWNmn2rwoQU2sk?= =?utf-8?q?Y0H9csbFQTuYI2kv382LOenB4xKr6/+kGAX1DQvKdFSuOCa1VRZ5gYVF?= =?utf-8?q?Lqokq6UHCeHuGYL9m46IyCvfR4Bi+D6pqW7EfNGZGJOqdDAbDkOmZjJo?= =?utf-8?q?PhBcIXNTK8TSwkLaYCQT11MDJGDErVwsnhGd3+lSdOoDdoWPg6DbCFcU?= =?utf-8?q?IruxVhC+mv/itGJyRN08y5O9WZrLPEJ7z9UTRGJPtOxnrPMCNndu96ET?= =?utf-8?q?xnsuChuVG5HLYrAgRcD2WkQX7slk/iEc8jd5US9NxSDarxBFmJKGTsQx?= =?utf-8?q?IfRWHgzmQgA1QqYgKFRZs+drpNP80nZqn2MtjYLVnryV3yAUOC2s7WuN?= =?utf-8?q?dbVUyl3CO3GxphgyWZLcwpl8bj93bzn?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: eae71990-c9ab-471a-cd29-08d97690e00c X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 08:31:25.7018 (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: u3QsZLkLkqe9YB4nyzcciD6I3f+8fQlHSJfmDzSw/Ylr8wPPlX4Dqqrk1jbGQwM/REl69zM4rgcZaGYhMEVCnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3263 Precedence: bulk List-ID: X-Mailing-List: netdev@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;