Merge branch 'upstream' into 17.11.x
[deb_dpdk.git] / drivers / net / ark / ark_pktchkr.c
index 62b3673..202a1d9 100644 (file)
@@ -112,6 +112,10 @@ ark_pktchkr_init(void *addr, int ord, int l2_mode)
        struct ark_pkt_chkr_inst *inst =
                rte_malloc("ark_pkt_chkr_inst",
                           sizeof(struct ark_pkt_chkr_inst), 0);
+       if (inst == NULL) {
+               PMD_DRV_LOG(ERR, "Failed to malloc ark_pkt_chkr_inst.\n");
+               return inst;
+       }
        inst->sregs = (struct ark_pkt_chkr_stat_regs *)addr;
        inst->cregs =
                (struct ark_pkt_chkr_ctl_regs *)(((uint8_t *)addr) + 0x100);
@@ -372,7 +376,7 @@ set_arg(char *arg, char *val)
                        o->v.INT = atoll(val);
                        break;
                case OTSTRING:
-                       strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+                       snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
                        break;
                }
                return 1;