[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c2e8022-155a-ba6c-a9c7-4a7eb9f6f916@embeddedor.com>
Date: Thu, 30 Mar 2023 14:44:59 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Tzung-Bi Shih <tzungbi@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] platform/chrome: Fix -Warray-bounds warnings
>> /* 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
Powered by blists - more mailing lists