bus/dpaa: check flag in qman multi enqueue
authorNipun Gupta <nipun.gupta@nxp.com>
Tue, 23 Jan 2018 12:27:01 +0000 (17:57 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 31 Jan 2018 12:44:41 +0000 (13:44 +0100)
A caller may/may not pass the flags in qman enqueue multi API.
This patch adds a check on that flag and only accesses it if passed
by the caller.

Fixes: 43797e7b4774 ("bus/dpaa: support event dequeue and consumption")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/bus/dpaa/base/qbman/qman.c

index 609bc76..e7fdf03 100644 (file)
@@ -2198,7 +2198,7 @@ int qman_enqueue_multi(struct qman_fq *fq,
                eq->fd.addr = cpu_to_be40(fd->addr);
                eq->fd.status = cpu_to_be32(fd->status);
                eq->fd.opaque = cpu_to_be32(fd->opaque);
-               if (flags[i] & QMAN_ENQUEUE_FLAG_DCA) {
+               if (flags && (flags[i] & QMAN_ENQUEUE_FLAG_DCA)) {
                        eq->dca = QM_EQCR_DCA_ENABLE |
                                ((flags[i] >> 8) & QM_EQCR_DCA_IDXMASK);
                }