Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compat: avoid fortify memcpy/memmove warnings on linux>=6.11 #266

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

okt-sergeyn
Copy link
Contributor

Avoid false-positive warnings like:
memcpy: detected field-spanning write (size 1436) of single field "dest" at src/lib/transport/ip/tcp_tx_reformat.c:74 (size 0)

Since actual allocation is bigger than ci_ip_pkt_fmt struct size, it is safe to copy beyond the struct.
Use unsafe_memcpy()/unsafe_memmove() for copying to ci_ip_pkt_fmt struct in a few places, which trigger the warning:
ci_tcp_tx_merge_segment(), ci_tcp_rx_pkt_coalesce() and do_copy_from_user().

Avoid false-positive warnings like:
memcpy: detected field-spanning write (size 1436) of single field "dest"
at src/lib/transport/ip/tcp_tx_reformat.c:74 (size 0)

Since actual allocation is bigger than ci_ip_pkt_fmt struct size,
it is safe to copy beyond the struct.
Use unsafe_memcpy()/unsafe_memmove() for copying to ci_ip_pkt_fmt struct
in a few places, which trigger the warning:
ci_tcp_tx_merge_segment(), ci_tcp_rx_pkt_coalesce()
and do_copy_from_user().

Signed-off-by: Sergey Nikitin <[email protected]>
@okt-sergeyn okt-sergeyn requested a review from a team as a code owner February 26, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants