From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF357C433F5 for ; Mon, 31 Jan 2022 16:49:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380633AbiAaQtm (ORCPT ); Mon, 31 Jan 2022 11:49:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380616AbiAaQtX (ORCPT ); Mon, 31 Jan 2022 11:49:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47B63C061714; Mon, 31 Jan 2022 08:49:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA99060B58; Mon, 31 Jan 2022 16:49:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 132DCC340E8; Mon, 31 Jan 2022 16:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643647762; bh=jSlR0Ku6H+5Q0glrHsE2hxMaoDdNYeF1Plc8PvJ9Jr0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=HEX1WXp8CNmeczzTfusuIZoaGOayKsUt+uKdCfEHP1G3UsjfmqaEygGMQSStRtIJ7 ROVShGUIrG7cx9al6RxoXKP81ryXJ0Sng7rco+WDGZNuuTrgQ4aWgkoNFaQBeOlC+L gd3hy2Kw4Iq3i8dJonI0Li2bkMaBe8tsZ1jnheGDye3e3pac1Xq+sPkAgjzDgXwpxj EFPX6fLd4r3nXHInuY+RqvCcrTHPF7ogPgVeIPQs420YonZGK1yPOkszzbus9inIwt r2hhboInvPHCaEZs7ZbhyPiesmWBNJTHDg7MuTcYlvVOpUf0lbpvU0aeGdYDmcsI8O MFTwMRgrFDTGg== From: Kalle Valo To: Andy Shevchenko Cc: Hector Martin , "David S. Miller" , Jakub Kicinski , Rob Herring , "Rafael J. Wysocki" , Len Brown , Arend van Spriel , Franky Lin , Hante Meuleman , Wright Feng , Dmitry Osipenko , Sven Peter , Alyssa Rosenzweig , Mark Kettenis , =?utf-8?Q?Rafa=C5=82_Mi=C5=82ecki?= , Pieter-Paul Giesberts , Linus Walleij , Hans de Goede , "John W. Linville" , "brian m. carlson" , "open list\:TI WILINK WIRELES..." , netdev , devicetree , Linux Kernel Mailing List , ACPI Devel Maling List , "open list\:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" , SHA-cyfmac-dev-list@infineon.com, Arend van Spriel , Stable Subject: Re: [PATCH v4 3/9] brcmfmac: firmware: Do not crash on a NULL board_type References: <20220131160713.245637-1-marcan@marcan.st> <20220131160713.245637-4-marcan@marcan.st> Date: Mon, 31 Jan 2022 18:49:13 +0200 In-Reply-To: (Andy Shevchenko's message of "Mon, 31 Jan 2022 18:28:25 +0200") Message-ID: <878ruvetpy.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andy Shevchenko writes: > On Mon, Jan 31, 2022 at 6:07 PM Hector Martin wrote: >> >> This unbreaks support for USB devices, which do not have a board_type >> to create an alt_path out of and thus were running into a NULL >> dereference. > > ... > >> @@ -599,6 +599,9 @@ static char *brcm_alt_fw_path(const char *path, >> const char *board_type) >> char alt_path[BRCMF_FW_NAME_LEN]; >> char suffix[5]; >> >> + if (!board_type) >> + return NULL; > > I still think it's better to have both callers do the same thing. > > Now it will be the double check in one case, I already applied a similar patch: https://git.kernel.org/wireless/wireless/c/665408f4c3a5 -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches