]> git.baikalelectronics.ru Git - kernel.git/commit
gve: enhance no queue page list detection
authorHaiyue Wang <haiyue.wang@intel.com>
Tue, 15 Feb 2022 05:17:49 +0000 (13:17 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 16 Feb 2022 02:01:06 +0000 (18:01 -0800)
commit8b7915e7933f00e5e76e12afd47fda09d4e904ed
tree31384490264c736ecc900f8fb256d73010b85915
parent6eb2b53ca77fd169c0db832808d1f21ed6da0e73
gve: enhance no queue page list detection

The commit
7cbeb9cb59d0 ("gve: Introduce per netdev `enum gve_queue_format`")
introduces three queue format type, only GVE_GQI_QPL_FORMAT queue has
page list. So it should use the queue page list number to detect the
zero size queue page list. Correct the design logic.

Using the 'queue_format == GVE_GQI_RDA_FORMAT' may lead to request zero
sized memory allocation, like if the queue format is GVE_DQO_RDA_FORMAT.

The kernel memory subsystem will return ZERO_SIZE_PTR, which is not NULL
address, so the driver can run successfully. Also the code still checks
the queue page list number firstly, then accesses the allocated memory,
so zero number queue page list allocation will not lead to access fault.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Bailey Forrest <bcf@google.com>
Link: https://lore.kernel.org/r/20220215051751.260866-1-haiyue.wang@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/google/gve/gve_main.c