Chrome platform driver development
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Tzung-Bi Shih <tzungbi@kernel.org>,
	"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: Fix -Warray-bounds warnings
Date: Thu, 30 Mar 2023 14:44:59 -0600	[thread overview]
Message-ID: <6c2e8022-155a-ba6c-a9c7-4a7eb9f6f916@embeddedor.com> (raw)
In-Reply-To: <ZCUzw9epJig2rTIY@google.com>


>>   	/* NB: we only kmalloc()ated enough space for the op field */
>> -	params = (struct ec_params_vbnvcontext *)msg->data;
>> -	params->op = EC_VBNV_CONTEXT_OP_READ;
>> +	params_op = (uint32_t *)msg->data;
>> +	*params_op = EC_VBNV_CONTEXT_OP_READ;
> 
> I don't see a good reason to partially allocate memory here.  Perhaps, just
> let `para_sz = sizeof(struct ec_params_vbnvcontext)`?  If it also makes
> sense to you, please remove the comment "NB: we only..." as well.

It looks funny to me, too. However, I think that's material for a different
patch.

What I want to get fixed here is the -Warray-bounds warning, while not messing
too much with the original implementation. :)

Thanks
--
Gustavo

  parent reply	other threads:[~2023-03-30 22:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  1:54 [PATCH][next] platform/chrome: Fix -Warray-bounds warnings Gustavo A. R. Silva
2023-03-30  7:01 ` Tzung-Bi Shih
2023-03-30  7:11   ` Greg KH
2023-03-30 20:44   ` Gustavo A. R. Silva [this message]
2023-12-14 16:35 ` Kees Cook
2023-12-14 16:37 ` Kees Cook
2023-12-15  8:17 ` Tzung-Bi Shih

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=6c2e8022-155a-ba6c-a9c7-4a7eb9f6f916@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --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 \
    --cc=tzungbi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox