1
0
Fork 0
forked from mirror/openwrt
openwrt/package
Jan Hoffmann 6df4e4663b ltq-vdsl-vr11-mei: fix field-spanning write warning
Since the update to kernel 6.1, a warning like this appears in the
kernel log:

[   49.773953] ------------[ cut here ]------------
[   49.773998] WARNING: CPU: 3 PID: 2349 at target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/dsl_cpe_mei-ugw_8.5.2.10/src/drv_mei_cpe_msg_process.c:3570 MEI_IoctlCmdMsgWrite+0x290/0x2c8 [drv_mei_cpe]
[   49.777670] memcpy: detected field-spanning write (size 4) of single field "pDestPtr" at target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/dsl_cpe_mei-ugw_8.5.2.10/src/drv_mei_cpe_msg_process.c:3570 (size 2)
...
[   50.087078] ---[ end trace 0000000000000000 ]---

The variable "pDestPtr" points to the field "header.index" in a
CMV_STD_MESSAGE_T struct (header is a CMV_STD_MESSAGE_HEADER_T struct).
The offending code intentionally copies data beyond this field, which is
followed by "header.length" and "payload".

To fix this, change the assignment of "pDestPtr" to use the pointer to
the message plus the offset of the "header.index" field. This way, the
compiler knows about the size and thus the false positive warning
disappears.

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.

Fixes: https://github.com/openwrt/openwrt/issues/17142
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250206225444.2521817-1-jan@3e8.eu/
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-02-22 18:53:05 +01:00
..
base-files base-files: fix offset conversion on caldata_patch_data() 2025-02-13 00:26:23 +01:00
boot arm-trusted-firmware-mediatek: update to upstream release 2025-02-12 2025-02-20 00:05:52 +00:00
devel strace: Update to version 6.12 2025-01-02 20:52:14 +01:00
firmware qualcommax: ipq50xx: add support for Linksys SPNMX56 2025-02-18 09:37:25 +01:00
kernel ltq-vdsl-vr11-mei: fix field-spanning write warning 2025-02-22 18:53:05 +01:00
libs openssl: update to 3.0.16 2025-02-16 12:59:49 +01:00
network wifi-scripts: failed to start hostapd if he_spr_psr_enabled is set 2025-02-19 08:07:52 +01:00
system apk: disable python module 2025-02-18 15:10:59 +01:00
utils yafut: update to a version that builds on macOS 2025-02-19 09:37:46 +01:00
Makefile build: lock versions for special APK packages 2025-02-04 13:48:59 +00:00