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: 12488193 X-Patchwork-Delegate: johannes@sipsolutions.net 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=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 1B63DC433F5 for ; Mon, 13 Sep 2021 08:33:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0464760F46 for ; Mon, 13 Sep 2021 08:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238572AbhIMIe1 (ORCPT ); Mon, 13 Sep 2021 04:34:27 -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?9z5J0V94lIM0fiIBNn3R8DGuwmaF?= =?utf-8?q?II19dmAH2/NkCv4IidXgNi3JlYZqOk4RLIrMBDSj5v6p5eTSR803TgnzQxWvQx9eG?= =?utf-8?q?VSZZExTFa+ZJsT/E13nBApDsfSydJEeAyKypMEOZsFRlxptfwxmApda8nxHrFwGZX?= =?utf-8?q?Vos8q+htNsMUjgLWFX4TSx0hOfotU34CJz65ZHsWTGhS6ypTJqRnyxrytWwTnBAEY?= =?utf-8?q?5K0o3Fp1ouwa4n5lk9GRToA3e7q4yVd4EkQbKgUKcMz8WFqLyTwMlefdoaCDZrFkZ?= =?utf-8?q?sGDFuucLgRqMu/sSBVvzYOK0PgfmtaazNP4sWKO82LvZd4otQqXjudVCRu0BrKZ99?= =?utf-8?q?73THpttkBukC8D8DXx1TnoeTWrOVir8ML4scS1KHiM/ORYBoY3aULX/QLGIjPzmd6?= =?utf-8?q?WyXMgCQVUeLMI4D+a4ApJ84M3+F4HdHT3QVfjUWkOjmKNVjshvB3G9OaYh8ext5MF?= =?utf-8?q?3KrDj88vD9JIYdLfIuv626XNqb+iGhQX/1r6Z17LXTcDY0cp343lyka3jdLaKewBw?= =?utf-8?q?FaZrI9qTnPtc/JrT7iU1YbLJcq2Dkel/Ms59Vq8SkgEnH5fB2aCfC+Ue+qMqBBC1L?= =?utf-8?q?3tgLlFh1pwHaoChVsLuYym7kXiZAeMAqriAFc/Dk6DOl8koKEEOPMgii4wCoCoW5L?= =?utf-8?q?S0/J0nrxd5HcWesBtzrZdYzZDGlsZzYMCD+ZpU3UdcU8UnvwYArGjBkpVQ+/rGY+f?= =?utf-8?q?XWqtB+LztJuB87dUouCZOJ2xITRQDCPPQZVhRBgR84OYA0WQ0u+jxnQeOWUzNhYko?= =?utf-8?q?cYhiNhyu0R5jrjwR9o1Jce9GYkCpanD1aBXecnsfz/TNpUfxLAXI6F+dG2xQEY8qM?= =?utf-8?q?ZyhNxUKTkAxcdtYz/YXQ5+An8XfiomNMuSESq2kdb9ooVd+zy/pVm5o67IpFf/nWu?= =?utf-8?q?betE+DzdfvfbLjVbYcdkcINCTqWNmn2rwoQU2skY0H9csbFQTuYI2kv382LOenB4x?= =?utf-8?q?Kr6/+kGAX1DQvKdFSuOCa1VRZ5gYVFLqokq6UHCeHuGYL9m46IyCvfR4Bi+D6pqW7?= =?utf-8?q?EfNGZGJOqdDAbDkOmZjJoPhBcIXNTK8TSwkLaYCQT11MDJGDErVwsnhGd3+lSdOoD?= =?utf-8?q?doWPg6DbCFcUIruxVhC+mv/itGJyRN08y5O9WZrLPEJ7z9UTRGJPtOxnrPMCNndu9?= =?utf-8?q?6ETxnsuChuVG5HLYrAgRcD2WkQX7slk/iEc8jd5US9NxSDarxBFmJKGTsQxIfRWHg?= =?utf-8?q?zmQgA1QqYgKFRZs+drpNP80nZqn2MtjYLVnryV3yAUOC2s7WuNdbVUyl3CO3Gxphg?= =?utf-8?q?yWZLcwpl8bj93bzn?= 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: 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;