]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: octeontx2 - Call strscpy() with correct size argument
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 11 Aug 2025 09:24:57 +0000 (11:24 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 Aug 2025 09:28:44 +0000 (17:28 +0800)
In otx2_cpt_dl_custom_egrp_create(), strscpy() is called with the length
of the source string rather than the size of the destination buffer.

This is fine as long as the destination buffer is larger than the source
string, but we should still use the destination buffer size instead to
call strscpy() as intended. And since 'tmp_buf' is a fixed-size buffer,
we can safely omit the size argument and let strscpy() infer it using
sizeof().

Fixes: d9d7749773e8 ("crypto: octeontx2 - add apis for custom engine groups")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c

index cc47e361089a05c8b2e174c79b5bbb43ed48f455..ebdf4efa09d4d70733671343f0bc21f2276970d2 100644 (file)
@@ -1615,7 +1615,7 @@ int otx2_cpt_dl_custom_egrp_create(struct otx2_cptpf_dev *cptpf,
                return -EINVAL;
        }
        err_msg = "Invalid engine group format";
-       strscpy(tmp_buf, ctx->val.vstr, strlen(ctx->val.vstr) + 1);
+       strscpy(tmp_buf, ctx->val.vstr);
        start = tmp_buf;
 
        has_se = has_ie = has_ae = false;