I'm not sure what you mean, isn't this already done? There is anThis can overflow the memory allocated to val, we should be careful here+ }
+ memcpy(val, buf, sizeof(*val));
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.
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).