Re: [PATCH 2/4] thermal: imx: Add support for reading OCOTP through nvmem

From: Srinivas Kandagatla
Date: Fri Jul 14 2017 - 06:54:47 EST




On 14/07/17 11:49, Leonard Crestez wrote:
+ }
+ memcpy(val, buf, sizeof(*val));
This can overflow the memory allocated to val, we should be careful here
not to do so.
limit this to sizeof(u32) should be good. Also add some sanity checks to
make sure that len is atleast 4 bytes.
I'm not sure what you mean, isn't this already done? There is an
explicit check above that the read len is exactly as expected. It's
just that the limit is written as sizeof(*val) rather than sizeof(u32).

Opps, I overlooked the type.. it looks okay.

thanks,
srini