On Tue, Jun 23, 2026 at 10:33:09AM -0700, Stephen Hemminger wrote: > On Tue, 23 Jun 2026 17:51:30 +0100 > Bruce Richardson <[email protected]> wrote: > > > Many uses of strncpy in DPDK drivers can be directly replaced by > > a call to strlcpy instead, which is safer in that it always null- > > terminates the string. This AI assisted patchset makes those > > simple replacements, adjusting lengths as appropriate. > > > > After this set, there are still a number of drivers with strncpy calls > > in them, but those are not simple strncpy->strlcpy replacements, so > > left for later rework. > > Maybe a coccinelle script?
Don't think it's worth it. a) All trivial replacements are already done by this set and the other patches I've posted. b) AI does a better job of handling this anyway, since it's able to properly analyse the context and spot cases of using a length parameter one short when calling strncpy, or when code is improved by using sizeof() as the length parameter. What probably is needed in scripting though, is a checkpatch check for new strncpy additions. Are you still working on that python replacement? /Bruce

