Build on Linux 7.2 and 7.3 - #373
Merged
Merged
Conversation
Linux 7.2 dropped strncpy(), so the driver no longer builds there: os_dep/linux/os_intfs.c:1455: error: implicit declaration of function 'strncpy' Two kinds of call sites, with different replacements: - Copies of exactly n bytes into buffers the surrounding code already zero-fills or terminates (snprintf chunks in rtw_debug.c, ParseQualifiedString(), the band/path/sign selectors in PHY_ConfigRFWithTxPwrTrackParaFile(), the FW trace handler, the "wlan10" ifname, the netlink ring_name): memcpy(). strscpy() would reserve one of the n bytes for the terminator and drop the last character. ring_name keeps the strncpy() bound of MIN(sizeof(ring_name) - 1, nla_len), so the copy never reads past the attribute payload; the buffer is zero-initialised. - Copies bounded by the destination size (old_ifname, crypt.alg, mon_ndev->name): strscpy(), which always terminates, so the manual dst[size - 1] = 0 lines go away. The WoWLAN pattern parser copies the last token with a fixed length of 2 even when the token is empty; strncpy() stopped at the terminator, so bound the memcpy() by strnlen() and zero the 2-byte member first to keep the padding strncpy() provided. strscpy() exists since 4.3, so no version guard is needed. Assisted-by: Claude:claude-fable-5.1
Linux 7.2 added `const u8 *rx_addr` to the remain_on_channel cfg80211 op, so the ops-table initialiser fails with an incompatible pointer type. Take the argument on 7.2 and newer; the driver has no use for it. Assisted-by: Claude:claude-fable-5.1
Linux 7.3 changed remain_on_channel() and mgmt_tx() to receive the cookie as `u64` instead of `u64 *`: cfg80211 now assigns the cookie itself and expects the driver to report completions with that value. Keep one local per function (roc_cookie / tx_cookie) that holds the cookie in use. On 7.3+ it is the value cfg80211 passed in; before 7.3 the driver still generates it and writes it back through the pointer, because cfg80211 hands in an uninitialised variable and reads it back to identify the request in later cancel calls. Based on EvilOlaf/rtl8192eu-linux-driver a236269 and 84c4bfd. Assisted-by: Claude:claude-fable-5.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the 7.2/7.3 CI question in #366; not a one-liner after all.
7.2 removed strncpy(): 28 call sites become memcpy() (byte-count copies, where strscpy() would drop the last character) or strscpy() (destination-sized copies, manual terminators dropped). 7.2 also added rx_addr to remain_on_channel().
7.3 passes the cookie to remain_on_channel()/mgmt_tx() by value; before 7.3 the driver still generates it and writes it back through the pointer.
Built against 7.2.3 headers (arm64), module links. Independent of #366.