All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Lukasz Majczak <lma@chromium.org>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Benson Leung <bleung@chromium.org>,
	chrome-platform@lists.linux.dev, linux-watchdog@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] watchdog: cros-ec: Avoid -Wflex-array-member-not-at-end warning
Date: Thu, 27 Mar 2025 06:27:09 +0000	[thread overview]
Message-ID: <Z-TvvUsB0eK2p8YJ@google.com> (raw)
In-Reply-To: <Z-SBITmMfwjocYwL@kspp>

On Wed, Mar 26, 2025 at 04:35:13PM -0600, Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
> 
> Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of
> a flexible structure where the size of the flexible-array member
> is known at compile-time, and refactor the rest of the code,
> accordingly.
> 
> So, with these changes, fix the following warning:
> 
> rivers/watchdog/cros_ec_wdt.c:29:40: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
 ^
 d truncated.

> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

With minor comments,
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>

> +	DEFINE_RAW_FLEX(struct cros_ec_command, buf, data,
> +			sizeof(union cros_ec_wdt_data));

s/buf/msg/g makes much sense.

> +	((union cros_ec_wdt_data *)buf->data)->req = arg->req;

Or,
*(struct ec_params_hang_detect *)buf->data = arg->req;

> -	arg->resp = buf.data.resp;
> +	arg->resp = ((union cros_ec_wdt_data *)buf->data)->resp;

Or,
arg->resp = *(struct ec_response_hang_detect *)buf->data;

      reply	other threads:[~2025-03-27  6:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26 22:35 [PATCH][next] watchdog: cros-ec: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-03-27  6:27 ` Tzung-Bi Shih [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-TvvUsB0eK2p8YJ@google.com \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=gustavoars@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lma@chromium.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.