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: Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] platform/chrome: cros_ec: Avoid -Wflex-array-member-not-at-end warning
Date: Tue, 1 Apr 2025 10:17:48 +0000	[thread overview]
Message-ID: <Z-u9TNrnEGD8fM8V@google.com> (raw)
In-Reply-To: <Z-apE0ZmckBjRDyx@kspp>

On Fri, Mar 28, 2025 at 07:50:11AM -0600, Gustavo A. R. Silva wrote:
> +union cros_ec_sleep_data {
> +	struct ec_params_host_sleep_event req0;
> +	struct ec_params_host_sleep_event_v1 req1;
> +	struct ec_response_host_sleep_event_v1 resp1;
> +} __packed;

The __packed modifier seems redundant.

>  static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
>  {
>  	int ret;
> -	struct {
> -		struct cros_ec_command msg;
> -		union {
> -			struct ec_params_host_sleep_event req0;
> -			struct ec_params_host_sleep_event_v1 req1;
> -			struct ec_response_host_sleep_event_v1 resp1;
> -		} u;
> -	} __packed buf;
> +	DEFINE_RAW_FLEX(struct cros_ec_command, msg, data,
> +			sizeof(union cros_ec_sleep_data));

Is it possible to use something similar to:

MAX(MAX(sizeof(A), sizeof(B)),
    sizeof(C))

so that the union doesn't need to be defined?

      reply	other threads:[~2025-04-01 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 13:50 [PATCH][next] platform/chrome: cros_ec: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-04-01 10:17 ` 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-u9TNrnEGD8fM8V@google.com \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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.