staging: rtl8723bs: Avoid field-overflowing memcpy()
authorKees Cook <keescook@chromium.org>
Fri, 6 Aug 2021 20:14:22 +0000 (13:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Aug 2021 10:09:37 +0000 (12:09 +0200)
commit859c57f606c78cb8b33cabbd22ad1d4ff9f80e4e
tree84f71e13b26942af5b0a94f35ea6444800655fe5
parent1b3c6cccda3f012ffab8287f1d6151492055340e
staging: rtl8723bs: Avoid field-overflowing memcpy()

In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memcpy(), memmove(), and memset(), avoid
intentionally writing across neighboring fields.

Adjust memcpy() destination to be the named structure itself, rather than
the first member, allowing memcpy() to correctly reason about the size.

"objdump -d" shows no object code changes.

Cc: Ross Schmidt <ross.schm.dev@gmail.com>
Cc: Joe Perches <joe@perches.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210806201422.2871679-1-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme.c