From: Ferruh Yigit <ferruh.yigit@intel.com> To: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>, Thomas Monjalon <thomas@monjalon.net>, Gaetan Rivet <grive@u256.net>, Stephen Hemminger <stephen@networkplumber.org>, Qi Zhang <qi.z.zhang@intel.com>, Ali Alnubani <alialnu@mellanox.com>, Yuanhan Liu <yuanhan.liu@linux.intel.com>, Matan Azrad <matan@mellanox.com>, Konstantin Ananyev <konstantin.ananyev@intel.com>, Zhiyong Yang <zhiyong.yang@intel.com>, Adrien Mazarguil <adrien.mazarguil@6wind.com> Cc: dev@dpdk.org, "Min Hu (Connor)" <humin29@huawei.com>, stable@dpdk.org, Kevin Traynor <ktraynor@redhat.com> Subject: Re: [dpdk-stable] [PATCH v9] ethdev: add sanity checks in control APIs Date: Wed, 21 Apr 2021 15:17:40 +0100 Message-ID: <b83d0bcc-9cd2-544f-a0ec-8ac58ab7cbe3@intel.com> (raw) In-Reply-To: <7b5f899e-aa34-ac36-ace3-7b2830257ff4@oktetlabs.ru> On 4/21/2021 12:28 PM, Andrew Rybchenko wrote: > On 4/21/21 5:36 AM, Ferruh Yigit wrote: >> From: "Min Hu (Connor)" <humin29@huawei.com> >> >> This patch adds more sanity checks in control path APIs. >> >> Fixes: 214ed1acd125 ("ethdev: add iterator to match devargs input") >> Fixes: 3d98f921fbe9 ("ethdev: unify prefix for static functions and variables") >> Fixes: 0366137722a0 ("ethdev: check for invalid device name") >> Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model") >> Fixes: 5b7ba31148a8 ("ethdev: add port ownership") >> Fixes: f8244c6399d9 ("ethdev: increase port id range") >> Cc: stable@dpdk.org >> >> Signed-off-by: Min Hu (Connor) <humin29@huawei.com> >> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> >> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru> >> Acked-by: Kevin Traynor <ktraynor@redhat.com> <...> >> @@ -3323,6 +3457,21 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, >> >> RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >> dev = &rte_eth_devices[port_id]; >> + >> + if (ptypes == NULL) { >> + RTE_ETHDEV_LOG(ERR, >> + "Cannot get ethdev port %u supported packet types to NULL\n", >> + port_id); >> + return -EINVAL; >> + } >> + >> + if (num == 0) { >> + RTE_ETHDEV_LOG(ERR, >> + "Cannot get ethdev port %u supported packet types to array with zero size\n", >> + port_id); >> + return -EINVAL; >> + } >> + > > The error condition is "ptypes == NULL && num > 0". > Otherwise, if num == 0 (regardless ptypes) it is just > a call to get size of required buffer. Same as below. > >> RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0); >> all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev); >> > Ack. Thanks for catching these issues.
prev parent reply other threads:[~2021-04-21 14:17 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <1618645179-11582-1-git-send-email-humin29@huawei.com> 2021-04-21 2:36 ` Ferruh Yigit 2021-04-21 10:48 ` Thomas Monjalon 2021-04-21 11:28 ` Andrew Rybchenko 2021-04-21 12:36 ` Min Hu (Connor) 2021-04-21 12:38 ` Kevin Traynor 2021-04-21 13:19 ` Ferruh Yigit 2021-04-21 13:40 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit 2021-04-21 13:50 ` Andrew Rybchenko 2021-04-21 13:50 ` [dpdk-stable] " Andrew Rybchenko 2021-04-21 14:17 ` Ferruh Yigit [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=b83d0bcc-9cd2-544f-a0ec-8ac58ab7cbe3@intel.com \ --to=ferruh.yigit@intel.com \ --cc=adrien.mazarguil@6wind.com \ --cc=alialnu@mellanox.com \ --cc=andrew.rybchenko@oktetlabs.ru \ --cc=dev@dpdk.org \ --cc=grive@u256.net \ --cc=humin29@huawei.com \ --cc=konstantin.ananyev@intel.com \ --cc=ktraynor@redhat.com \ --cc=matan@mellanox.com \ --cc=qi.z.zhang@intel.com \ --cc=stable@dpdk.org \ --cc=stephen@networkplumber.org \ --cc=thomas@monjalon.net \ --cc=yuanhan.liu@linux.intel.com \ --cc=zhiyong.yang@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
patches for DPDK stable branches This inbox may be cloned and mirrored by anyone: git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \ stable@dpdk.org public-inbox-index stable Example config snippet for mirrors. Newsgroup available over NNTP: nntp://inbox.dpdk.org/inbox.dpdk.stable AGPL code for this site: git clone https://public-inbox.org/public-inbox.git