Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2987229lqp; Mon, 25 Mar 2024 15:47:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXZ5kc3FsbOGtu0/9Ch+wkA+e2mcc++KTTp6At5XxdqTqNOso7MSdpSV+T3rH9YtwoBA9M3HSp965X7x7VmI0vvroskUtGH/FzmTPyfBw== X-Google-Smtp-Source: AGHT+IHnlAHnIImbdGklSu/rBbsLBg45lz8jAcFHxyXJQV1/GxV649AdMrXz5v7dUcbLB0KMphoz X-Received: by 2002:ac8:5c92:0:b0:431:4e0f:772c with SMTP id r18-20020ac85c92000000b004314e0f772cmr5452433qta.30.1711406840260; Mon, 25 Mar 2024 15:47:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711406840; cv=pass; d=google.com; s=arc-20160816; b=NX81LngM23/kxf/mmvWDbPZ2cK6BU24us9eNg+rxISeEysiCH5k4c64Gs0EJy5KrtX 8nPK7+Yd8TlDrzQBLLWzFB4hipfbNkdumAGgr0L8oUZYODmMO3iuv5r4XTJlmeQInQyz oGnOQ3yElTT/KKOROJwzGRykcK2dgMtihqdV9iQNvxPfuu4eJOoG7PtiXltIhhOGlXQE oXLQbJtcoPff4dMH1sS2a8BJQLH/GKc41RhdXIME08nJFIt8CCqYiW2sobYXAvSEhisj 9vMZb8BY8o5Gb3vflKls5hFIQ57AfFHQui4lHhOi/1a1yhhoD4mLkm0rm9S5Y0kS7fCf nhhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MlPMTJaNGiZjUvi6saKf2R4Fpag5/u1oxV37EUoykZM=; fh=F9nN+bqlCXSjq3IU1uNbRSBV7MdoSjD90kcbSdGnK4M=; b=WMUTRFbzAyJyHxKBWLkfayUNBcOMJuqqKu3dWh/anCeGdDva7rbfg0SWEfjzwlppgV 6nRBqPUXUwQVhqxzT2iI6Tw/6z9V4cZ1qgY9rHAqIVb2NUEifzgEV/h/4S23c7nghzhf nGcYYWVE2N27c8kbl2xPnGGdw5AGWLEKSv8azu+aOwDhBCHBN/ClGO6U+7FLE43sFmYb wXco8JR9CkNm92myb3vuksSg00T9E4H1ZmwKE9VV8adwp/CcZl1Xj8D1EvkLzH09pZLM 0KjTRIZyPcHpC5FyWtt+KWnBuMkk4TI3aXDeNDPzWnYZG3a15SNB8pIlG5szUd8Excas gDXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=TLMprQLF; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-118138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118138-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n16-20020ac85a10000000b00430a55825f4si6458830qta.189.2024.03.25.15.47.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 15:47:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=TLMprQLF; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-118138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118138-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0368C1C3AB31 for ; Mon, 25 Mar 2024 22:47:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 123257F7CB; Mon, 25 Mar 2024 22:47:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="TLMprQLF" Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF7257F7E8 for ; Mon, 25 Mar 2024 22:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711406832; cv=none; b=ChKG2HYjDKUTs4rvYyZt3ufI7AwVPoGtzbLr5QbTl4DHp67IJsJRBWh8CXeMu+MiOcE0zlWsLbS8M/XUqNepKkzOFf79m3BL5idWdKQk2xfgJyCqcDSgPwVm3kAWD3osSiGUxblDlXs1ANcmQKv4aD5VrLBvggWRGpNTwHd+CQo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711406832; c=relaxed/simple; bh=GKS0Tf6qp+BZ9KFCahLUmOaP97KsUUjEX2vETGsJmws=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hMP2QxPdcbT1Q1QkYbjMkrMQ6EWEGWtAiZ8TiN1pq+BFU2BJmdtl7AreD/Gx8HsamguzBFiC6g6Km8CZ2Jk+HVbYedmYMVwxif9T30wPvMGRok2TZzwjFRnDPuJLSrU2Aemxz9oERKOynphSQ3Axms2R+Nrefp7rZGkkcl+ETiM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=TLMprQLF; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-42f4b66dc9eso27600021cf.2 for ; Mon, 25 Mar 2024 15:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1711406828; x=1712011628; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MlPMTJaNGiZjUvi6saKf2R4Fpag5/u1oxV37EUoykZM=; b=TLMprQLFoU0fsfiXEsQ49dVFY0jaX8bOVIkyRiQE0z0vPv3TV3PTU3206uoZ9xCDtd JSqu7YLYqf3mtyeIrT4dZ+jmC5QcOzTh5YIadjrXkhmdccSU208K+Toqc9IDrmp0TFeA kp/9w/EaZ0JoiSJKcWLHl0YQmLDBoz4cvh0hSIeyn4PrYZTGHWc5NrWCKqFYpWmQprad hvEMUgDq0e/iqpeoma2FF+IqHaZ1GDpskBCcc05H59LcCZrN9znMdBMx45KyPPdh/5nN SD+vqEf85qM7dWslNxnsVFzjGEH5WTnT5OLnGkdw//x5lP4Jo33NGvFANuY+7+5oZEYT gJfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711406828; x=1712011628; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MlPMTJaNGiZjUvi6saKf2R4Fpag5/u1oxV37EUoykZM=; b=DVvarcI1cVx7cOEFysrptlY+5e7KekPcn9P9IpSylBlvQAG3VDalhu6kzWyBi4oC5/ ZficfLVs5m+xkXXt7542MJBcitMaZSdOVIU+/VW/8wr6fwVPEgIPqVn458fAWMgQnaRg 9U+OfQVHPisqJ0cL+WMrTCYGWUJnbBlsFwpvysJrjYLOZtNgVz76TTISw87UPDm9Rf0p ZIyFCg79Gqcb+QKJXAMrShzji0hneI/fOJMfNkleUykc08brBb52pc39FUMcN5VkcsR5 0DmljfyucWyC8T+5fIOmXeJVM8JiBa4bsFkNETcp7hRoH/Ob7Y8a+tczotTVAqZT9AW5 HSYA== X-Forwarded-Encrypted: i=1; AJvYcCX9rywK/eCWlhXK85HOUta2byyPow6oqOIUmM78CJNJwUg3syNhYV1HzlMx0Jg5W3x3oqyaTa9YNVBGikV+gp1Qm4bSSiwoENpUZIs/ X-Gm-Message-State: AOJu0YzYUKd9edMSsIwBczz7C6HjKpiYt/rkK1TCOD62+FXjqcHjFnY2 eFkCfaQ12rr0zibbkwduc84bEYYo8joTSLvK2QlqdS/QRFO1ekdxFC4oXq8Lb/o= X-Received: by 2002:ac8:5a8c:0:b0:431:621d:46ed with SMTP id c12-20020ac85a8c000000b00431621d46edmr2407680qtc.28.1711406827783; Mon, 25 Mar 2024 15:47:07 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id cr10-20020a05622a428a00b00430a44f49dasm3048635qtb.7.2024.03.25.15.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 15:47:07 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rot5u-001VXC-N0; Mon, 25 Mar 2024 19:47:06 -0300 Date: Mon, 25 Mar 2024 19:47:06 -0300 From: Jason Gunthorpe To: "Gustavo A. R. Silva" Cc: Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] RDMA/cm: Avoid -Wflex-array-member-not-at-end warning Message-ID: <20240325224706.GB8419@ziepe.ca> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Mar 25, 2024 at 02:24:07PM -0600, Gustavo A. R. Silva wrote: > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > Use the `struct_group_tagged()` helper to separate the flexible array > from the rest of the members in flexible `struct cm_work`, and avoid > embedding the flexible-array member in `struct cm_timewait_info`. > > Also, use `container_of()` to retrieve a pointer to the flexible > structure. > > So, with these changes, fix the following warning: > drivers/infiniband/core/cm.c:196:24: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] > > Signed-off-by: Gustavo A. R. Silva > --- > drivers/infiniband/core/cm.c | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) > > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c > index bf0df6ee4f78..80c87085499c 100644 > --- a/drivers/infiniband/core/cm.c > +++ b/drivers/infiniband/core/cm.c > @@ -182,18 +182,21 @@ struct cm_av { > }; > > struct cm_work { > - struct delayed_work work; > - struct list_head list; > - struct cm_port *port; > - struct ib_mad_recv_wc *mad_recv_wc; /* Received MADs */ > - __be32 local_id; /* Established / timewait */ > - __be32 remote_id; > - struct ib_cm_event cm_event; > + /* New members must be added within the struct_group() macro below. */ > + struct_group_tagged(cm_work_hdr, hdr, > + struct delayed_work work; > + struct list_head list; > + struct cm_port *port; > + struct ib_mad_recv_wc *mad_recv_wc; /* Received MADs */ > + __be32 local_id; /* Established / timewait */ > + __be32 remote_id; > + struct ib_cm_event cm_event; > + ); > struct sa_path_rec path[]; > }; I didn't look, but does it make more sense to break out the path side into its own type and avoid the struct_group_tagged? I seem to remember only one thing used it. Jason