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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 19A3DC433B4 for ; Fri, 23 Apr 2021 12:54:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C658D611AE for ; Fri, 23 Apr 2021 12:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231220AbhDWMy4 (ORCPT ); Fri, 23 Apr 2021 08:54:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230305AbhDWMy4 (ORCPT ); Fri, 23 Apr 2021 08:54:56 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D95E4C061574; Fri, 23 Apr 2021 05:54:19 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1lZvJs-00Fh3U-Nc; Fri, 23 Apr 2021 14:54:04 +0200 Message-ID: <17adb27af76820813c035874fad7e468681bfe04.camel@sipsolutions.net> Subject: Re: [PATCH] brcmfmac: fix a loop exit condition From: Johannes Berg To: Christophe JAILLET , Dan Carpenter Cc: Arend van Spriel , Matthias Brugger , Franky Lin , Hante Meuleman , Chi-hsien Lin , Wright Feng , Chung-hsien Hsu , Kalle Valo , Hans deGoede , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, kernel-janitors@vger.kernel.org Date: Fri, 23 Apr 2021 14:54:03 +0200 In-Reply-To: References: <427e33af49758c61bc23cf1eedb6dd6964c40296.camel@sipsolutions.net> <20210423121110.GO1981@kadam> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: kernel-janitors@vger.kernel.org On Fri, 2021-04-23 at 14:20 +0200, Christophe JAILLET wrote: > > > > > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > > > > @@ -34,7 +34,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, > > > >    len = strlen(tmp) + 1; > > > >    board_type = devm_kzalloc(dev, len, GFP_KERNEL); > > > >    strscpy(board_type, tmp, len); > > > > - for (i = 0; i < board_type[i]; i++) { > > > > + for (i = 0; i < len; i++) { > > > >    if (board_type[i] == '/') > > > >    board_type[i] = '-'; > > > >    } > > > > > > It should probably just use strreplace() though :) > > > > Good point. I'll send a v2. > > > > and the 2 lines above look like a devm_kstrdup. > > The (unlikely) malloc failure test is also missing. How many issues can you have in 6 lines of code ;-) johannes