From patchwork Sun Nov 1 20:36:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 83302 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EA0F4A04E7; Sun, 1 Nov 2020 21:38:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 619862986; Sun, 1 Nov 2020 21:38:08 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id E33B928EE for ; Sun, 1 Nov 2020 21:38:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604263084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R95FMIJMKnIo1DudSHV0ex8TsxEoLZ7b6KnywOXGcJo=; b=PyLE/sqdxgeUr4HNjvwgywe+vWGWyKhIkAg/pHO43wXPx7354ED+GkPpDKcwlp2+5DHAtO sRF5luA8lwP+cHRKsbNLbMAfbS+BC09fKU+HnAF6ruUWFUQsZ5F8fhU7V0ovxr8zWEY0Bo HZtCtdm5D/xuSDFj6pVWVtJqGJAKq5Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-Gecbuk9-NgW2OWFaEw5mEw-1; Sun, 01 Nov 2020 15:38:01 -0500 X-MC-Unique: Gecbuk9-NgW2OWFaEw5mEw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52C6E107ACF5; Sun, 1 Nov 2020 20:38:00 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2435810027AA; Sun, 1 Nov 2020 20:37:58 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: timothy.mcdaniel@intel.com, Jerin Jacob Date: Sun, 1 Nov 2020 21:36:44 +0100 Message-Id: <20201101203644.1697-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH] eventdev: check input parameter for dump op X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Rather than have drivers check for this, let's ensure the passed FILE * is not NULL. Signed-off-by: David Marchand Reviewed-by: Timothy McDaniel --- lib/librte_eventdev/rte_eventdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 994bd1eaa9..afbadc535b 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1153,6 +1153,8 @@ rte_event_dev_dump(uint8_t dev_id, FILE *f) RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); dev = &rte_eventdevs[dev_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dump, -ENOTSUP); + if (f == NULL) + return -EINVAL; (*dev->dev_ops->dump)(dev, f); return 0;