Repository navigation
Conversation
The strncpy function was removed in Linux 7.2. Replace all instances of
it with strscpy to allow building on kernel versions >=7.2, resolving
the following error, among others:
../xocl_subdev.c: In function ‘__xocl_subdev_create’:
../xocl_subdev.c:623:33: error: implicit declaration of function ‘strncpy’ [-Wimplicit-function-declaration]
623 | strncpy(subdev->res_name +
| ^~~~~~~
../xocl_subdev.c:22:1: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
21 | #include "version.h"
+++ |+#include <string.h>
22 |
../xocl_subdev.c:623:33: warning: incompatible implicit declaration of built-in function ‘strncpy’ [-Wbuiltin-declaration-mismatch]
623 | strncpy(subdev->res_name +
| ^~~~~~~
../xocl_subdev.c:623:33: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
../xocl_subdev.c: In function ‘xocl_fetch_dynamic_platform’:
../xocl_subdev.c:1438:25: warning: incompatible implicit declaration of built-in function ‘strncpy’ [-Wbuiltin-declaration-mismatch]
1438 | strncpy(core->vbnv_cache, dsa_map[i].vbnv,
| ^~~~~~~
../xocl_subdev.c:1438:25: note: include ‘<string.h>’ or provide a declaration of ‘strncpy’
Signed-off-by: Isaac True <isaac@is.having.coffee>
IsaacJT
force-pushed
the
itrue/fix-kernel-7.2
branch
from
October 16, 2026 15:57
f89710b to
f0cdb04
Compare
1 similar comment
This branch has not been deployed
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.
Problem solved by the commit
The
strncpyfunction was removed in Linux 7.2, causing the kernel module build to fail with the following error (among others):Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
Upstream commit which removed
strncpysupport: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a3746ccbb0a97bed3c06ccde6b880013b1dddc1How problem was solved, alternative solutions (if any) and why they were rejected
Invocations of the
strncpyfunction were replaced bystrscpy, which copies a string and ensures it is NULL-terminated.Risks (if any) associated the changes in the commit
strscpyhas been around for over 10 years, so there should be no risks with kernel versions involved.One potential risk is that a section of code is relying on some specific kind of behaviour from
strncpy(intentionally or otherwise) thatstrscpydoes not replicate.What has been tested and how, request additional testing if necessary
Kernel module compilation has been performed on kernels 7.2 (Debian unstable) and 7.3 (Ubuntu 26.10)