Re: [PATCH][next] platform/chrome: Fix -Warray-bounds warnings

From: Gustavo A. R. Silva
Date: Thu Mar 30 2023 - 18:45:54 EST



/* 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