lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac2b001d-68eb-46c4-ac38-5207161ff104@stanley.mountain>
Date: Fri, 21 Mar 2025 17:33:56 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Shannon Nelson <shannon.nelson@....com>
Cc: jgg@...dia.com, andrew.gospodarek@...adcom.com,
	aron.silverton@...cle.com, dan.j.williams@...el.com,
	daniel.vetter@...ll.ch, dave.jiang@...el.com, dsahern@...nel.org,
	gregkh@...uxfoundation.org, hch@...radead.org, itayavr@...dia.com,
	jiri@...dia.com, Jonathan.Cameron@...wei.com, kuba@...nel.org,
	lbloch@...dia.com, leonro@...dia.com, linux-cxl@...r.kernel.org,
	linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
	saeedm@...dia.com, brett.creeley@....com
Subject: Re: [PATCH v4 5/6] pds_fwctl: add rpc and query support

On Wed, Mar 19, 2025 at 02:32:36PM -0700, Shannon Nelson wrote:
> +static struct pds_fwctl_query_data *pdsfc_get_endpoints(struct pdsfc_dev *pdsfc,
> +							dma_addr_t *pa)
> +{
> +	struct device *dev = &pdsfc->fwctl.dev;
> +	union pds_core_adminq_comp comp = {0};
> +	struct pds_fwctl_query_data *data;
> +	union pds_core_adminq_cmd cmd;
> +	dma_addr_t data_pa;
> +	int err;
> +
> +	data = dma_alloc_coherent(dev->parent, PAGE_SIZE, &data_pa, GFP_KERNEL);
> +	err = dma_mapping_error(dev, data_pa);
> +	if (err) {
> +		dev_err(dev, "Failed to map endpoint list\n");
> +		return ERR_PTR(err);
> +	}

This doesn't work.  The dma_alloc_coherent() function doesn't necessarily
initialize data_pa.  I don't know very much about DMA but can't we just
check:

	data = dma_alloc_coherent(dev->parent, PAGE_SIZE, &data_pa, GFP_KERNEL);
	if (!data)
		return ERR_PTR(-ENOMEM);

regards,
dan carpenter

> +
> +	cmd = (union pds_core_adminq_cmd) {
> +		.fwctl_query = {
> +			.opcode = PDS_FWCTL_CMD_QUERY,
> +			.entity = PDS_FWCTL_RPC_ROOT,
> +			.version = 0,
> +			.query_data_buf_len = cpu_to_le32(PAGE_SIZE),
> +			.query_data_buf_pa = cpu_to_le64(data_pa),
> +		}
> +	};
> +
> +	err = pds_client_adminq_cmd(pdsfc->padev, &cmd, sizeof(cmd), &comp, 0);
> +	if (err) {
> +		dev_err(dev, "Failed to send adminq cmd opcode: %u entity: %u err: %d\n",
> +			cmd.fwctl_query.opcode, cmd.fwctl_query.entity, err);
> +		dma_free_coherent(dev->parent, PAGE_SIZE, data, data_pa);
> +		return ERR_PTR(err);
> +	}
> +
> +	*pa = data_pa;
> +
> +	return data;
> +}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ