ltq-vdsl-vr9-mei: avoid unnecessary usage of unsafe_memcpy
authorJan Hoffmann <jan@3e8.eu>
Thu, 6 Feb 2025 22:54:25 +0000 (23:54 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 22 Feb 2025 17:53:19 +0000 (18:53 +0100)
commita9b4d1f4b904d47a304e1806bd9f363d3335554d
tree308af9994ace623e3e68be6a68bea2e874257693
parent6df4e4663b9e2b41b320630681b7692e0d3f8861
ltq-vdsl-vr9-mei: avoid unnecessary usage of unsafe_memcpy

Commit 7bc487c12eef ("kernel: ltq-vdsl-vr9-mei: fix warning about
field-spanning write") patched the driver to use unsafe_memcpy in
MEI_IoctlCmdMsgWrite.

However, this is not actually necessary. The assignment of the variable
"pDestPtr" can be modified so that the compiler knows about the correct
size. This way, the check in the fortified memcpy works correctly.

While at it, also adjust all places where similar code is used to copy
from a CMV_STD_MESSAGE_T struct.

Also mark all related structs as packed, because the code (and the
driver in general) seems to rely on that anyway.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250206225444.2521817-2-jan@3e8.eu/
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/kernel/lantiq/ltq-vdsl-vr9-mei/Makefile
package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/401-fix-field-spanning-write-mei-mailbox-packed.patch [new file with mode: 0644]
package/kernel/lantiq/ltq-vdsl-vr9-mei/patches/401-use-unsafe_memcpy-for-intentional-field-spanning-write.patch [deleted file]