Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2529757rwi; Fri, 28 Oct 2022 08:07:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40G1KmodJezAH3g97UMCTtU1e5B31iqKCW6G84LomGcmABvHIpBZOcVobkJ2HOV5x2Fzdt X-Received: by 2002:a17:902:ebce:b0:186:9905:11bf with SMTP id p14-20020a170902ebce00b00186990511bfmr31850776plg.110.1666969644676; Fri, 28 Oct 2022 08:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666969644; cv=none; d=google.com; s=arc-20160816; b=tCrepgsqHhDxF0ktX0ABlJZKVxXUjbpMxwp4zV01VF5yFCRhFYOAzru2Dhzf17Eq2V RpKfdpBtreuSyPAwimayvXPWdlrq4af/GI07+uH0I43lUqlWzuyhFjtU2WwMA6qG1PDN DFe5VskiXKsEaxPWQvBGwGerPXQL+sKrWuoGrOjrz26sugIQPmG/vcxHWdeu46Ja5KPR spAwmtMNa4JwlMy7dAYVMVULugeZdFcL6yMaAIaA2BKi0w8HEO7LCDa+j1rkjOnLXiJZ GTzXLLf3nmOTLdXUlb4627PJTmTLeh3rD+YJRR++oiop7oObRK6zZe4sdC2DjRkGKzKk 3Esg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=e6GFRQgsoXeD3cNEFTu5cbRh6crpsluz0XDUTOg8Aj4=; b=v1FhFNNqs60ijfwCaksLDP988bxydWwz+IPuPFRTKHmWr/z7N7P08oeFbPUnrLKb/5 kSH/Qj2EwDuc1NFyRNkHMb3OdD6STto64DmA8Y3qJRnefxQvHZbn1rvXTdpdc2uicMQg DnNyVW65HSBfPglviOp0mjLeGE48b2zDEy7d8+GF3BlnczJwqXU8gTAVMbBGDBL6O4xG rxvgTluq73il5gEkSC45cIiqoZ2wJW1yP7nJIYoqW6L8jreG767/DT4rNFVBDcCz9Rhw DfcfJq7wdO0Qp0Ib2A7G+d2UeR08P4oICW/MBR8Bo4lE7ivvwFBqvld8WOhcN5SGOI9u F0TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="EmFDo/MZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u31-20020a63455f000000b0046eed3142cesi5530790pgk.350.2022.10.28.08.07.11; Fri, 28 Oct 2022 08:07:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="EmFDo/MZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbiJ1OpY (ORCPT + 99 others); Fri, 28 Oct 2022 10:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230123AbiJ1OpP (ORCPT ); Fri, 28 Oct 2022 10:45:15 -0400 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05ABA357E2 for ; Fri, 28 Oct 2022 07:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1666968300; bh=mdSWCcF+ehTdqpHVPnOPb5xbBX/ETvgcAIilH0Cbb4I=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=EmFDo/MZazdAovn4VL2C5AlRlcbeL1ShND8gNv0dHKFUuBag61CXbNjUg/agNuBVd feiXa4HiKXGHUm/B3o74i8nnMYOCp2z6+cxYyUXRQQJdUOZC+Y89fTVEzTeGmNgg7Y GHk6DPxIkkXr8bc4miuQXmHaaitr96c6fX6F+1qw= Received: by b-4.in.mailobj.net [192.168.90.14] with ESMTP via [213.182.55.206] Fri, 28 Oct 2022 16:45:00 +0200 (CEST) X-EA-Auth: WKm+ykEDblvvS9vl+J6LYpyOlc8N+KKX4SjMBJDLRC8uUG50BXfxPBZz9Cw0IZVCy7C/657sqQ1BoGSCZMkbhhuH5RliNvRu Date: Fri, 28 Oct 2022 20:14:53 +0530 From: Deepak R Varma To: Dan Carpenter Cc: outreachy@lists.linux.dev, Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: wlan-ng: Use flexible-array for one / zero-length arrays Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 28, 2022 at 05:36:41PM +0300, Dan Carpenter wrote: > On Fri, Oct 28, 2022 at 06:08:13PM +0530, Deepak R Varma wrote: > > Flexible-array member should be used instead of one or zero member to > > meet the need for having a dynamically sized trailing elements in a > > structure. Refer to links [1] and [2] for detailed guidance on this > > suggestion. > > > > [1] https://en.wikipedia.org/wiki/Flexible_array_member > > [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays > > > > Issue identified using coccicheck. > > > > Signed-off-by: Deepak R Varma > > --- > > drivers/staging/wlan-ng/p80211mgmt.h | 8 ++++---- > > drivers/staging/wlan-ng/p80211types.h | 2 +- > > 2 files changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/staging/wlan-ng/p80211mgmt.h b/drivers/staging/wlan-ng/p80211mgmt.h > > index 1ef30d3f3159..d6fe52de2c8f 100644 > > --- a/drivers/staging/wlan-ng/p80211mgmt.h > > +++ b/drivers/staging/wlan-ng/p80211mgmt.h > > @@ -229,14 +229,14 @@ struct wlan_ie { > > struct wlan_ie_ssid { > > u8 eid; > > u8 len; > > - u8 ssid[1]; /* may be zero, ptrs may overlap */ > > + u8 ssid[]; /* may be zero, ptrs may overlap */ > > } __packed; > > When you're writing this change look at where struct wlan_ie_ssid is > used. It's included in five different structs: > > struct wlan_ie_ssid *ssid; > > But none of those *ssid pointers are used. So instead of doing this > just delete the wlan_ie_ssid struct and delete every reference to it. > Send that as a patch by itself and then repeat that process for the next > struct. Thank you Dan. I had the same observation, but was not sure if that clean up should be included as part of current patch scope. Now I will, as you advised. Also, there are a few function declarations that I do not think are used in the code anywhere. File: drivers/staging/wlan-ng/p80211mgmt.h Line number : 500 through 519 Can you please comment if it is safe to remove these functions and include this clean-up as well in the proposed patch? Thank you, ./drv > > regards, > dan carpenter >