Re: [PATCH] devlink/param: replace deprecated strcpy() with strscpy()
From: Jakub Kicinski
Date: Thu May 07 2026 - 10:59:43 EST
On Thu, 7 May 2026 09:04:45 +0100 David Laight wrote:
> > case DEVLINK_PARAM_TYPE_STRING:
> > - len = strnlen(nla_data(param_data), nla_len(param_data));
> > - if (len == nla_len(param_data) ||
> > - len >= __DEVLINK_PARAM_MAX_STRING_VALUE)
> > + len = strscpy(value->vstr, nla_data(param_data));
> > + if (len < 0)
> > return -EINVAL;
> > - strcpy(value->vstr, nla_data(param_data));
>
> The only sensible thing here is to replace the strcpy() with:
> memcpy(value->vstr, nla_data(param_data), len + 1);
That'd probably be a good move, to avoid getting the broken strscpy()
conversion submissions. Care to send a patch?