https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90673
--- Comment #6 from Yaro Slav <yaro330 at gmail dot com> --- (In reply to Kees Cook from comment #5) > From the linked code: > > missing = copy_from_user(dbg_buff, buf, sizeof(buf)); > > dbg_buff is a global variable -- is writing to it thread safe? > > sizeof(buf) is 8. (it's a pointer not an array), so that seems the wrong > size? > > I bet the error message for __bad_copy_to is busted and it really means > __bad_copy_from. The code that you used as an example is "fixed", gcc doesn't warn about it, it warns when instead of 'sizeof(buf)' we pass 'count'.