[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202504071331.D9E4D6B058@keescook>
Date: Mon, 7 Apr 2025 13:36:16 -0700
From: Kees Cook <kees@...nel.org>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Lukasz Majczak <lma@...omium.org>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
Guenter Roeck <linux@...ck-us.net>,
Benson Leung <bleung@...omium.org>,
Tzung-Bi Shih <tzungbi@...nel.org>, chrome-platform@...ts.linux.dev,
linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] watchdog: cros-ec: Avoid
-Wflex-array-member-not-at-end warning
On Mon, Apr 07, 2025 at 01:42:07PM -0600, Gustavo A. R. Silva wrote:
>
> >
> > > + msg->command = EC_CMD_HANG_DETECT;
> > > + msg->insize = (arg->req.command == EC_HANG_DETECT_CMD_GET_STATUS) ?
> > > + sizeof(struct ec_response_hang_detect) :
> > > + 0;
> > > + msg->outsize = sizeof(struct ec_params_hang_detect);
> > > + *(struct ec_params_hang_detect *)msg->data = arg->req;
> > > +
> > > + ret = cros_ec_cmd_xfer_status(cros_ec, msg);
> > > if (ret < 0)
> > > return ret;
> > > - arg->resp = buf.data.resp;
> > > + arg->resp = *(struct ec_response_hang_detect *)msg->data;
> >
> > msg->data used twice and a "sizeof()" earlier... might be nicer to have
> > an explicit pointer?
>
> Those are two different pointers:
>
> *(struct ec_params_hang_detect *)msg->data = arg->req;
> arg->resp = *(struct ec_response_hang_detect *)msg->data;
Argh. I did it again. I can't see "params" vs "response". q_q
Sorry for the noise!
Reviewed-by: Kees Cook <kees@...nel.org>
--
Kees Cook
Powered by blists - more mailing lists