Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a38964b4 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: ipa: Fix copy destination compiler error



There are a lot of these error messages scattered throughout gsi and ipa
files:

./include/linux/thread_info.h:147:4: error: call to '__bad_copy_to' declared
with attribute error: copy destination size is too small

This is because the compiler can't be sure that the size of the copy will
fit in the structure. This seems to be caused by the bounds check that
precedes the copy_from_user calls:

  if (sizeof(dbg_buff) < count + 1)

It looks like this has to do with the possibility that (count + 1) could
wrap. This is logically the same check without the math:

  if (count >= sizeof(dbg_buff))

Change all the prior logic to the latter to quiet the warnings. But we can
go even further - most of the copy_from_user() functions are converted to
an integer of some type so we can skip a lot of the copy math and just use
strtoXXX_from_user where XXX is the type to convert from.  This helps get
rid of a lot of the original copy_from_user() complaints (but not all and
thats okay).

Fixes: 859783a1 ("msm: ipa: Add snapshot of IPA driver")
Change-Id: Ic0dedbad314dd4ba7a6c31e62b9d2f409f9a1593
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 0467cd78
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment