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]
Date:   Mon, 26 Nov 2018 15:04:52 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Rob Herring <robh@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v3 2/3] ACPI: property: Add acpi_fwnode_name()

On Mon, Nov 26, 2018 at 02:47:51PM +0300, Heikki Krogerus wrote:
> This implements the get_name fwnode op for ACPI.

> +static int
> +acpi_fwnode_get_name(const struct fwnode_handle *fwnode, char *buf, size_t len)
> +{
> +	struct acpi_buffer buffer;
> +	acpi_handle handle;
> +	acpi_status status;
> +
> +	if (is_acpi_data_node(fwnode)) {
> +		snprintf(buf, len, "%s", to_acpi_data_node(fwnode)->name);

Same question as per patch 1. How are we going to handle bigger strings?

> +		return 0;
> +	}
> +
> +	handle = to_acpi_device_node(fwnode)->handle;
> +

> +	buffer.length = min((size_t)ACPI_NAME_SIZE + 1, len);

Hmm...

 min_t(size_t, ...) ?


> +	buffer.pointer = buf;
> +
> +	status = acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);

And same question here. Is it possible to get length of the name and check?

Perhaps, I would return -ENAMETOOLONG (-EOVERFLOW) or alike for such cases.

> +	if (ACPI_FAILURE(status))
> +		return -ENXIO;
> +	return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ