Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2407001rwi; Fri, 28 Oct 2022 06:48:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EbGQaiAdiqH+MK7sAGPsmRx7GasyFHP7BErPlO0UZfKv3fjDGgLnrGBEBhf46hR4Rf6Ru X-Received: by 2002:a05:6402:5191:b0:462:a5f1:4599 with SMTP id q17-20020a056402519100b00462a5f14599mr6973999edd.35.1666964915146; Fri, 28 Oct 2022 06:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666964915; cv=none; d=google.com; s=arc-20160816; b=oHTOE5r3D27O9w8eJoI324jGKhMNr6piRuIeXfGhNtQCKNZs5PjqSjXYHUt5AIA12w L5vkpHFhm/My2rB0OgKN2LJDgXd4Fj0VGutnuscdrLeNKh0SFYcf0LsMPQivgDQ74ah0 ZjK2C/+LrWb4fGZGW8QDvNMhroetiL2l4inVzXwQ0s6fl3vZw2rOrm+mczqCClMr6You HAK6sVDK1zcm58+MpkugQrDFJYGXCsQdILNz0BxL1e6SoRwpa3MdrWvgB6d5rZcZ63ZB 85LNdVJYjiaWFbyIpgZO1nL8WJl2sbu9n7O5BNggEbYFIV9oqiCy5IH7IJOhlFrg6XRy 9zdg== 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=o7+ZjNTs0TepRWMFYdzJvTC4rTqUeRhtBV7kwUpJQTE=; b=QRCfau101243anD/NQmDPcyqKJW2fQSvgB5xB6tzDkZSxmWxOl38sAQ16VUEBP5vbi eNtjdJMoRoj3akh76DH68DkCcdbj94L2iHvtvtXVA5f5pNw97VkFrSRvvTjIUxycfcqr TZtff87uIa5CZ9ca65y1w9H05DbzJBQ8gw7ub6Dqj7+M6CSiEUJB9BCrJRcmwpv/YTOf 2X4JdBo/XzwUWRJq1MpuN3Uzc+NOnH9BhlJ6LLnxRH+NcjSpIP4aaqAndDdc6T9H7J6J rv94hM7n0mX4DwEUbCw7gH1E7pe5iNTpB8CilnHR/lJHY4BzTf7xc5itPFvshABwEOec jjaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=BuiTchFx; 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 s10-20020a50d48a000000b00461cb15df6dsi4605641edi.297.2022.10.28.06.48.09; Fri, 28 Oct 2022 06:48:35 -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=BuiTchFx; 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 S231273AbiJ1NmS (ORCPT + 99 others); Fri, 28 Oct 2022 09:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbiJ1Nl7 (ORCPT ); Fri, 28 Oct 2022 09:41:59 -0400 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A558E1D79B2 for ; Fri, 28 Oct 2022 06:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1666964465; bh=dn3QC759JYSbdACAbjB+1SsJHL5LPhszMOHvnTxlp2w=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=BuiTchFxwmMu50w2A1Gk7O5uorgN0Egt4VIWDmHCUxOezqWSX1TL6MV2fySdDIRR/ cfS8TdPTYmdcPJzIw4vXy1jimJZu16I3YEbDOXGgH/4CKG8q8Pqm1eootTMe2XdZI3 yuG2kQgtmBQhGEQfLzsg6o0ydaHzy1Io+eD4j0D0= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via [213.182.55.206] Fri, 28 Oct 2022 15:41:05 +0200 (CEST) X-EA-Auth: zjD3JWTuqW65h7OUlWQt+bac8mNfQPBdWtxbP4lNIW7AbDNyWoG0bkvLonVx/zdZDq6GcPCSy3C56muCCKIQ3DX2aRhZjmRq Date: Fri, 28 Oct 2022 19:11:00 +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 04:33:59PM +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 */ > > How have you ensured that changing this from a 1 byte array to a zero > byte array does not break anything? It's not uncommon for a people > to do math like "size - 1 + length". The "- 1" would be to take the > 1 element into consideration. Hi Dan, I did a code review to understand how this structure member is used and did not find any computations you mentioned. I would certainly like to receive your feedback as well. > > I was trying to read through this code to check your work, but then > you sent a second patch which also does not explain how you are auditing > your changes. Can you go a bit slower? My apologies for rushing patches in. I will hold on for feedback on these patches before turning in any new patch involving similar change. I hope it is okay to send a different type of patch though. Please correct if I am wrong. Thank you for looking into the patches. Appreciate your time and feedback. ./drv > > regards, > dan carpenter >