- for (i = 0; i < RTE_LIBRTE_DPAA_MAX_CRYPTODEV; i++) {
- char sec_name[16];
-
- snprintf(sec_name, 16, "dpaa_sec-%d", i+1);
- if (strcmp(sec_name, sep) == 0) {
- if (out_name)
- strcpy(out_name, sep);
- free(dup_name);
- return 0;
- }
+ if (out != NULL) {
+ char *out_name = out;
+ const size_t max_name_len = sizeof("fm.-mac..") - 1;
+
+ /* Do not check for truncation, either name ends with
+ * '\0' or the device name is followed by parameters and there
+ * will be a ',' instead. Not copying past this comma is not an
+ * error.
+ */
+ strlcpy(out_name, &name[delta], max_name_len + 1);
+
+ /* Second digit of mac%u could instead be ','. */
+ if ((strlen(out_name) == max_name_len) &&
+ out_name[max_name_len] == ',')
+ out_name[max_name_len] = '\0';