Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1450436pxy; Thu, 29 Apr 2021 07:23:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRba8+ksySwApStntfB8mwkHozF3hTTZ/AOffC45iasVICcyvb4x1P4SbwooeviTMJmE3R X-Received: by 2002:a05:6402:1cc1:: with SMTP id ds1mr17943974edb.135.1619706183614; Thu, 29 Apr 2021 07:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619706183; cv=none; d=google.com; s=arc-20160816; b=afPs8wF7O4uNyDrPB454/LIylunflwOoIhb5xqm4WM++fM4+t1SP0xzUQo6GXqsHQV sZEvmxJxoeiFfZI8WSBVo2hGoSaMKX9RjXSRKRI67EqAtfXxr717S5p4FQNmh7I7vIGP KkYQiSDVRMqJYQnu6O+952EmwR11Nqg1d1tE+eV05GKrh01Kboe81VJG+166AcyXZisU DiG6mYOoOS8h1soddKGznRYwnviNPAjA9nlX7kbZJ93jZy2/CniGShfT33H/LyYcYXR6 gBak2T+WjD8FADH3g4xHPbBcXRYWWRFZGv0IDHk8d7gHfNQAAR4AfSyzsR78piSBzayK /qEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=NXpxgGCYotI1YSrgT91QdO23p7ZRQXUBQo7cq8qqeWo=; b=pocRlFr1NW63r37t2B3yN2zBKxduA7GEJBTi3Bb421wKlqvbVXGWhe5gPAjIY/Xqvh lPBX4hEvj6CH1ErJ75vcE9GiC7LfbOGg/gLPB2nnPv4gHDafaCsmdpnuv4fT43WYzrJI rcmR7cfk6WjdWyzSYu19Dc8YyaFMmLNCRj2PEqO05FX0qAiId2V0bnTRCA5hq+VNi8ja ayzWE2Sr9y7OEsIcQ4hKFFhQvTB9v6mpTqpr7tRjvpJGkdePaQkHFg0dHq0ZEUdQy0c/ gjXLXXbUpVpHFAJFcQHZCxa7SNtUEKTxfhjnnmi9XqU4uBR89Pj3P31+dWb1Zp6qV70T x/DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=YEp5amXo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si3137791edd.259.2021.04.29.07.22.39; Thu, 29 Apr 2021 07:23:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=YEp5amXo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238802AbhD2OWB (ORCPT + 99 others); Thu, 29 Apr 2021 10:22:01 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:59358 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235277AbhD2OWA (ORCPT ); Thu, 29 Apr 2021 10:22:00 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13TEGKEX007801; Thu, 29 Apr 2021 14:21:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=NXpxgGCYotI1YSrgT91QdO23p7ZRQXUBQo7cq8qqeWo=; b=YEp5amXoG2Kv30qElzWi+UYl1/NwyGurGFbCS5F460YbUcQ9yy2/3FwGjRi983he/MJT PV6Prxa7aNur0qykw5UXFXHz5loynmmgnjMcxwtM/XeB1glsYbDvXfi/3JHzTD5uCe5J D9v0CWFjDhMhBm7LkiwztY5Zlugf8eBIaq0oPdFiSc3yk8kzsUr5DoZxDC1AoEUjFdO3 5sO6Edu/8HIQNiCxRCsPBMY6KAFXwUn5WEwdGsmEU1vzWLOlj3eCTwMPcag67XcDq4Zp DoXbMi346Jk0Qlj7BZrmB2TckZGT1KIjRfSuzeZ8cwNhopCIRqN1UjtLI5b8Xr/qpt5s fQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 385ahbvj81-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Apr 2021 14:21:10 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13TEEtsl046291; Thu, 29 Apr 2021 14:21:09 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 3848f15kbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Apr 2021 14:21:09 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 13TEJx9O069966; Thu, 29 Apr 2021 14:21:08 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 3848f15kaq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 29 Apr 2021 14:21:08 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 13TEL6Z6012266; Thu, 29 Apr 2021 14:21:07 GMT Received: from kadam (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 29 Apr 2021 07:21:06 -0700 Date: Thu, 29 Apr 2021 17:20:58 +0300 From: Dan Carpenter To: Jitendra Khasdev Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8192e: fix array of flexible structures Message-ID: <20210429142058.GC1981@kadam> References: <20210427174945.1323-1-jkhasdev@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210427174945.1323-1-jkhasdev@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: ZH2M9C6mWshEeh263zv1pxORNm5ACUsI X-Proofpoint-ORIG-GUID: ZH2M9C6mWshEeh263zv1pxORNm5ACUsI X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9969 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1011 adultscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104290094 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 27, 2021 at 11:19:45PM +0530, Jitendra Khasdev wrote: > This patch fixes sparse warning "array of flexible structures" > for rtllib.h. > > eg. drivers/staging/rtl8192e/rtllib.h:832:48: warning: array of > flexible structures > > Signed-off-by: Jitendra Khasdev > --- > drivers/staging/rtl8192e/rtllib.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h > index 4cabaf2..c7cb318 100644 > --- a/drivers/staging/rtl8192e/rtllib.h > +++ b/drivers/staging/rtl8192e/rtllib.h > @@ -802,7 +802,7 @@ struct rtllib_authentication { > __le16 transaction; > __le16 status; > /*challenge*/ > - struct rtllib_info_element info_element[]; > + struct rtllib_info_element *info_element; > } __packed; This patch is wrong. The original code is basically fine. Normally it doesn't make sense to have an array of flex arrays, but in this case it "flexes" between 0 and 1. If it were had two elements then the match the math wouldn't work at all. We should probably get rid of it and just add some giant comments and defines to do the math. But changing it to a pointer isn't right. regards, dan carpenter